|
2 | 2 | * IMPORTS: Libraries that steam-yellow uses. |
3 | 3 | */ |
4 | 4 | const SteamUser = require('steam-user'); |
5 | | -const readline = require('readline'); |
| 5 | +const inquirer = require('inquirer'); |
6 | 6 | const client = new SteamUser(); |
7 | 7 |
|
8 | | -// NodeJS Readline |
9 | | -const rl = readline.createInterface({ |
10 | | - input: process.stdin, |
11 | | - output: process.stdout |
12 | | -}); |
| 8 | +// Verbosing info to user |
| 9 | +console.log("Welcome to yellow-steam!"); |
| 10 | +console.log("Join our discord and steam group!"); |
| 11 | +console.log("WEBSITE: https://drakewitt.github.io/steam-yellow/"); |
13 | 12 |
|
| 13 | +let flags; |
14 | 14 | // Overwrite the SteamUser library's persona flags to make it yellow |
15 | 15 | SteamUser.prototype.setPersona = function (state, name) { |
16 | 16 | this._send(SteamUser.EMsg.ClientChangeStatus, { |
17 | 17 | "persona_state": state, |
18 | | - "persona_state_flags": 3847, // This makes it yellow |
| 18 | + "persona_state_flags": flags, // This makes it yellow |
19 | 19 | "player_name": name |
20 | 20 | }); |
21 | 21 | }; |
22 | | -// Verbosing info to user |
23 | | -console.log("Welcome to yellow-steam!"); |
24 | | -console.log("Join our discord and steam group!"); |
25 | | -console.log("WEBSITE: https://drakewitt.github.io/steam-yellow/"); |
26 | | - |
27 | | -// Prompt for username |
28 | | -rl.question('Username? ', (answer) => { |
29 | | - |
30 | | - let username = answer; |
31 | | - rl.question('Password? ', (answer) => { |
32 | | - let password = answer; |
33 | | - const logOnOptions = { |
34 | | - accountName: username, |
35 | | - password: password |
36 | | - }; |
37 | | - |
38 | | - client.logOn(logOnOptions); |
39 | | - |
40 | | - rl.close(); |
41 | | - }); |
42 | | -}); |
43 | | - |
44 | 22 | client.on('loggedOn', () => { |
45 | 23 | client.setPersona(SteamUser.Steam.EPersonaState.Online); |
46 | 24 | console.log("Logged In! Press CTRL and C to stop."); |
47 | 25 | }); |
| 26 | + |
| 27 | +// Prompt for stuff |
| 28 | +inquirer.prompt([ |
| 29 | + { |
| 30 | + name: 'accountName', |
| 31 | + message: 'Steam username:', |
| 32 | + type: 'input' |
| 33 | + }, |
| 34 | + { |
| 35 | + name: 'password', |
| 36 | + message: 'Steam password:', |
| 37 | + type: 'password' |
| 38 | + }, |
| 39 | + { |
| 40 | + name: 'flags', |
| 41 | + message: 'Please select which flags to enable:', |
| 42 | + type: 'checkbox', |
| 43 | + choices: [ |
| 44 | + {name: "Yellow name", |
| 45 | + value: 4, |
| 46 | + checked: true}, |
| 47 | + {name: "VR online indicator", |
| 48 | + value: 2048}, |
| 49 | + {name: "Mobile online indicator", |
| 50 | + value: 512}, |
| 51 | + {name: "Web online indicator", |
| 52 | + value: 256} |
| 53 | + ] |
| 54 | + } |
| 55 | +// then log in |
| 56 | +]).then(data => { |
| 57 | + flags = data.flags.reduce((v,p)=>v+p, 0); |
| 58 | + |
| 59 | + client.logOn(data); |
| 60 | +}); |
| 61 | + |
| 62 | + |
0 commit comments