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
41 lines (35 loc) · 1.18 KB
/
project4.js
File metadata and controls
41 lines (35 loc) · 1.18 KB
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
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!');
}
});
client.on('friendMessage', (steamid, message) => {
if (message === "Hello") {
client.chatMessage(steamid,"Hello There !");
} else if (message === "Hey") {
client.chatMessage(steamid,"Hey There !")
} else if (message === "!group") {
client.chatMessage(steamid,"Sending you a Group Invite!");
client.inviteToGroup(steamid, config.groupID);
// OR
community.inviteUserToGroup(steamid, config.groupID);
} else {
client.chatMessage(steamid,"I failed to understand you :/")
}
});