This project is a fork from Crazy-Duck's original bot
Wrapper around the node-dota2 library which handles all log-in shenanigans.
This basic DotaBot class prepares an object for connection to Steam and the
Dota2 Game Coordinator. As soon as connect(callback)
is called, the DotaBot
connects to Steam and the Dota2 GC. As soon as all connections are made,
the queue is started. From then on, all scheduled functions will be executed as
soon as the GC is available.
Run npm install node-dota2-bot
to install the package or clone from GitHub
steamClient
The steam client used to interact with Steam. See node-steam for details.steamUser
The steam user for account-related functionality, including logon.. See node-steam for details.steamFriends
The steam friends for community functionality, such as chats and friend messages. See node-steam for details.Dota2
The Dota2Client for interaction with the Dota2 Game Coordinator. See node-dota2 for details.
state
The current state of the queue (only getter).rate_limit
The current rate limiting factor, i.e. the time in milliseconds between requests.backoff
The current backoff factor used for exponential backoff.
logonDetails
Object with two properties,account_name
andpassword
debug
Boolean indicating whether or not basic debug info should be showndebugMore
Boolean indicating whether or not advanced debug info should be shown
Creates a new DotaBot ready to connect to Steam and the Dota2 GC
Connect to Steam and the Dota2 GC. DotaBot will keep the connections alive until disconnect()
is called
Disconnect from Steam and the Dota2 GC.
fn
Function to schedule for execution as soon as the GC is available
'use strict'
const DotaBot = require("DotaBot");
var logonDetails = {account_name: 'username', password:'password'};
var bot = new DotaBot(logonDetails, true, false);
bot.Dota2.on("profileCardData", function (accId, data) {
console.log(JSON.stringify(data));
});
bot.connect();
bot.schedule(()=>{bot.Dota2.requestProfileCard(63470426);});
setTimeout(()=>{bot.disconnect();}, 25000);
19 May 12:16:07 - Blocking queue
19 May 12:16:07 - Scheduling job
19 May 12:16:07 - Connected, logging on..
19 May 12:16:07 - Logged on with id = **********
19 May 12:16:07 - Launching Dota 2
19 May 12:16:07 - Received servers.
19 May 12:16:07 - sentryfile saved
19 May 12:16:08 - Sending ClientHello
19 May 12:16:08 - Received client welcome.
19 May 12:16:08 - Activating queue
19 May 12:16:08 - Executing job
19 May 12:16:08 - Sending profile card request
19 May 12:16:08 - Queue is empty, going idle
19 May 12:16:09 - Cache subscribed, type 7
19 May 12:16:09 - Unknown cache ID: 7
19 May 12:16:09 - Received profile card data for: 63470426
{"account_id":63470426,"background_def_index":0, ...
19 May 12:16:26 - Exiting Dota 2