npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dota-sentry

v0.0.4

Published

A library to gather player MMR, stats, and other info

Downloads

3

Readme

Sentry

A library to gather player MMR, stats, and other info

Installation

Installation instructions need to be updated when the package is added to npm.

Usage Example

Example needs to be updated when the package is added to npm.

var SentryModule = require('sentry');
var sentry = new SentryModule.Sentry({
  user: {
    name: 'my-name-to-show',
    username: 'my-username',
    password: 'my-password',
    status: 'Busy',
    guardCode: '1RRRR'
  }
});

sentry.getPlayerMMR(55555555).then(function(MMR) {
  console.log(`Solo MMR: ${MMR.solo}, Party MMR: ${MMR.party}`);
});

Methods

new Sentry(configuration, timeLimit, autoRelogin, autoReloginWaitTime)

Using the new keyword you create a Sentry object, this will perform a Steam login and launch Dota 2.

The configuration object should be in the following format:

{
  user: {
    username: '<string>',
    password: '<string>',
    name: '<string>',
    status: '<string>',
    guardCode: '<string>'
  }
}
  • name and status are optional
  • guardCode needs to be empty the first time and then filled with the value from steam guard, you need to call the login() method to get code

timeLimit is the default time to wait for a steam connection if it isn't ready. Defaults to 30000ms. Set autoRelogin to true to try to login after an error or disconnection. Defaults to true. autoReloginWaitTime is the time to wait between log in attempts when autoRelogin is true. Defaults to 5000ms.

waitUntilReady(timeLimit)

Returns a promise that resolves when the module is ready to receive other calls. Used internally. If timeLimit is not sent it will use the one sent in the Sentry constructor.

getPlayerMMR(playerId)

Gets a player solo and party MMR from the player id. playerId is the 8-digit profile ID from dota 2.

Returns a Promise that resolves with an object with the following format:

{
  solo: 9000,
  party: 9000
}

createLobby(options)

Creates a lobby with the specified options, it will also move the client to the spectators list. Returns a promise that resolves if the lobby is created correctly.

The options object needs to have the following format:

{
  name: <string>,
  region: <ServerRegion>,
  mode: <GameMode>,
  seriesType: <SeriesType>,
  cheats: <boolean>,
  fillWithBots: <boolean>,
  allowSpectators: <boolean>,
  password: <string>,
  firstPick: <PickPriority>,
  radiantWins: <number>,
  direWins: <number>,
  allchat: <boolean>,
  delay: <GameDelay>,
	leagueId: <number>
}

Values for GameDelay, GameMode, PickPriority, SeriesType and ServerRegion can be found in their respective enums in the module, e.g. SentryModule.GameMode.CM.

updateLobby(options)

Updates the current lobby with the specified options. Returns a promise that resolves if the options were set correctly.

The options object needs to have the following format:

{
  name: <string>,
  region: <ServerRegion>,
  mode: <GameMode>,
  seriesType: <SeriesType>,
  cheats: <boolean>,
  fillWithBots: <boolean>,
  allowSpectators: <boolean>,
  password: <string>,
  firstPick: <PickPriority>,
  radiantWins: <number>,
  direWins: <number>,
  allchat: <boolean>,
  delay: <GameDelay>,
	leagueId: <number>
}

Values for GameDelay, GameMode, PickPriority, SeriesType and ServerRegion can be found in their respective enums in the module, e.g. SentryModule.GameMode.CM.

getLobbyInfo()

Gets an object representing a dota lobby. Returns a promise that resolves with the lobby info.

The object will have the following format:

{
  lobbyId: <Long>,
  matchId: <Long>,
  options: {
    name: <string>,
    region: <ServerRegion>,
    mode: <GameMode>,
    seriesType: <SeriesType>,
    cheats: <boolean>,
    fillWithBots: <boolean>,
    allowSpectators: <boolean>,
    password: <string>,
    firstPick: <PickPriority>,
    radiantWins: <number>,
    direWins: <number>,
    allchat: <boolean>,
    delay: <GameDelay>,
    leagueId: <number>
  }
}

Values for GameDelay, GameMode, PickPriority, SeriesType and ServerRegion can be found in their respective enums in the module, e.g. SentryModule.GameMode.CM.

leaveLobby()

Leaves the current lobby. Returns a promise that resolves if the lobby was left correctly.

swapTeamsInLobby()

Changes the team's sides for the current lobby. Returns a promise that resolves if the teams swapped sides correctly.

Development

Dependencies

Setup

  • Download or clone the repository
  • Node and npm need to be installed in your computer
  • Run npm install

Testing

npm test can be used to run unit tests

Linter

npm run lint can be used to run the linter