forked from Steam-Bot-Basics/node-steam-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject4.js
More file actions
27 lines (21 loc) · 696 Bytes
/
project4.js
File metadata and controls
27 lines (21 loc) · 696 Bytes
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
const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const config = require('./config.json');
const client = new SteamUser();
const logOnOptions = {
accountName: config.username,
password: config.password,
twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret)
};
client.logOn(logOnOptions);
client.on('loggedOn', () => {
console.log('Logged into Steam');
client.setPersona(SteamUser.Steam.EPersonaState.Online);
client.gamesPlayed(440);
});
client.on('friendRelationship', (steamid, relationship) => {
if (relationship === 2) {
client.addFriend(steamid);
client.chatMessage(steamid, 'Hello there! Thanks for adding me!');
}
});