Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.12 KB

File metadata and controls

45 lines (32 loc) · 1.12 KB

Setup

First, install it from npm:

npm install dota2-user

Require the module and call its constructor with your SteamUser instance:

const SteamUser = require('steam-user');
const Dota2User = require('dota2-user').Dota2User;

const user = new SteamUser();
const dota2 = new Dota2User(user);
import SteamUser from 'steam-user';
import { Dota2User } from 'dota2-user';

const user = new SteamUser();
const dota2 = new Dota2User(user);

To initialize your GC connection, just launch Dota 2 via SteamUser normally:

client.gamesPlayed(570);
client.gamesPlayed(Dota2User.STEAM_APPID);

node-dota2-user will emit a connectedToGC event when the game coordinator connection has been successfully established. You shouldn't try to do anything before you receive that event.

Once connectedToGC has been emitted, you can send a message for example:

import { EDOTAGCMsg } from 'dota2-user/protobufs';
dota2.on('connectedToGC', () => {
    dota2.send(EDOTAGCMsg.k_EMsgGCMatchDetailsRequest, { matchId: '271145478' });
});

Please see examples/ for TypeScript examples.