-
Notifications
You must be signed in to change notification settings - Fork 0
/
steamClient.js
91 lines (74 loc) · 2.46 KB
/
steamClient.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var SteamUser = require('steam-user');
var SteamTotp = require('steam-totp');
var botFactory = {};
botFactory.buildBot = function (config)
{
var bot = new SteamUser({
promptSteamGuardCode: false,
dataDirectory: "./sentry",
singleSentryfile: false
});
bot.username = config.username;
bot.password = config.password;
bot.sharedSecret = config.sharedSecret;
bot.games = config.games;
bot.messageReceived = {};
bot.on('loggedOn', function(details) {
console.log("[" + this.username + "] Connecté à Steam avec le compte " + bot.steamID.getSteam3RenderedID());
bot.setPersona(SteamUser.EPersonaState.Online);
bot.gamesPlayed(this.games);
});
bot.on('error', function(e) {
console.log("[" + this.username + "] " + e);
setTimeout(function() {bot.doLogin();}, 30*60*1000);
});
bot.doLogin = function ()
{
this.logOn({
"accountName": this.username,
"password": this.password
});
}
bot.on('steamGuard', function(domain, callback) {
if ( !this.sharedSecret ) {
var readlineSync = require('readline-sync');
var authCode = readlineSync.question("[" + this.username + "] " + 'Steam Guard' + (!domain ? ' App' : '') + ' Code: ');
callback(authCode);
}
else {
var authCode = SteamTotp.generateAuthCode( this.sharedSecret );
console.log("[" + this.username + "] Code d'authentification généré: " + authCode);
callback(authCode);
}
});
bot.on("friendMessage", function(steamID, message) {
console.log("[" + this.username + "] Message de " + steamID+ ": " + message);
if ( !this.messageReceived[steamID] ) {
bot.chatMessage(steamID, "[Message automatique] Logiciel créer par xnooztv pour boost ses heures - http://steamcommunity.com/id/umer2231/");
this.messageReceived[steamID] = true;
}
});
bot.on('vacBans', function(numBans, appids) {
if(numBans > 0) {
console.log( "[" + this.username + "] " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + "." +
(appids.length == 0 ? '' : " In apps: " + appids.join(', ')) );
}
});
bot.on('accountLimitations', function(limited, communityBanned, locked, canInviteFriends) {
var limitations = [];
if(limited) {
limitations.push('LIMITED');
}
if(communityBanned) {
limitations.push('COMMUNITY BANNED');
}
if(locked) {
limitations.push('LOCKED');
}
if(limitations.length !== 0) {
console.log("[" + this.username + "] Limitations: " + limitations.join(', ') + ".");
}
});
return bot;
}
module.exports = botFactory;