steamcommunity 3.45.0 → 3.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,81 +1,81 @@
1
- // If you aren't running this script inside of the repository, replace the following line with:
2
- // const SteamCommunity = require('steamcommunity');
3
- const SteamCommunity = require('../index.js');
4
- const ReadLine = require('readline');
5
-
6
- let community = new SteamCommunity();
7
- let rl = ReadLine.createInterface({
8
- input: process.stdin,
9
- output: process.stdout
10
- });
11
-
12
- rl.question('Username: ', (accountName) => {
13
- rl.question('Password: ', (password) => {
14
- rl.question('Two-Factor Auth Code: ', (authCode) =>{
15
- rl.question('Revocation Code: R', (rCode) => {
16
- doLogin(accountName, password, authCode, '', rCode);
17
- });
18
- });
19
- });
20
- });
21
-
22
- function doLogin(accountName, password, authCode, captcha, rCode) {
23
- community.login({
24
- accountName: accountName,
25
- password: password,
26
- twoFactorCode: authCode,
27
- captcha: captcha
28
- }, (err, sessionID, cookies, steamguard) => {
29
- if (err) {
30
- if (err.message == 'SteamGuard') {
31
- console.log('This account does not have two-factor authentication enabled.');
32
- process.exit();
33
- return;
34
- }
35
-
36
- if (err.message == 'CAPTCHA') {
37
- console.log(err.captchaurl);
38
- rl.question('CAPTCHA: ', (captchaInput) => {
39
- doLogin(accountName, password, authCode, captchaInput);
40
- });
41
-
42
- return;
43
- }
44
-
45
- console.log(err);
46
- process.exit();
47
- return;
48
- }
49
-
50
- console.log('Logged on!');
51
-
52
- if (community.mobileAccessToken) {
53
- // If we already have a mobile access token, we don't need to prompt for one.
54
- doRevoke(rCode);
55
- return;
56
- }
57
-
58
- console.log('You need to provide a mobile app access token to continue.');
59
- console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
60
- console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
61
- console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
62
-
63
- rl.question('Access Token: ', (accessToken) => {
64
- community.setMobileAppAccessToken(accessToken);
65
- doRevoke(rCode);
66
- });
67
- });
68
- }
69
-
70
- function doRevoke(rCode) {
71
- community.disableTwoFactor('R' + rCode, (err) => {
72
- if (err) {
73
- console.log(err);
74
- process.exit();
75
- return;
76
- }
77
-
78
- console.log('Two-factor authentication disabled!');
79
- process.exit();
80
- });
81
- }
1
+ // If you aren't running this script inside of the repository, replace the following line with:
2
+ // const SteamCommunity = require('steamcommunity');
3
+ const SteamCommunity = require('../index.js');
4
+ const ReadLine = require('readline');
5
+
6
+ let community = new SteamCommunity();
7
+ let rl = ReadLine.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ });
11
+
12
+ rl.question('Username: ', (accountName) => {
13
+ rl.question('Password: ', (password) => {
14
+ rl.question('Two-Factor Auth Code: ', (authCode) =>{
15
+ rl.question('Revocation Code: R', (rCode) => {
16
+ doLogin(accountName, password, authCode, '', rCode);
17
+ });
18
+ });
19
+ });
20
+ });
21
+
22
+ function doLogin(accountName, password, authCode, captcha, rCode) {
23
+ community.login({
24
+ accountName: accountName,
25
+ password: password,
26
+ twoFactorCode: authCode,
27
+ captcha: captcha
28
+ }, (err, sessionID, cookies, steamguard) => {
29
+ if (err) {
30
+ if (err.message == 'SteamGuard') {
31
+ console.log('This account does not have two-factor authentication enabled.');
32
+ process.exit();
33
+ return;
34
+ }
35
+
36
+ if (err.message == 'CAPTCHA') {
37
+ console.log(err.captchaurl);
38
+ rl.question('CAPTCHA: ', (captchaInput) => {
39
+ doLogin(accountName, password, authCode, captchaInput);
40
+ });
41
+
42
+ return;
43
+ }
44
+
45
+ console.log(err);
46
+ process.exit();
47
+ return;
48
+ }
49
+
50
+ console.log('Logged on!');
51
+
52
+ if (community.mobileAccessToken) {
53
+ // If we already have a mobile access token, we don't need to prompt for one.
54
+ doRevoke(rCode);
55
+ return;
56
+ }
57
+
58
+ console.log('You need to provide a mobile app access token to continue.');
59
+ console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
60
+ console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
61
+ console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
62
+
63
+ rl.question('Access Token: ', (accessToken) => {
64
+ community.setMobileAppAccessToken(accessToken);
65
+ doRevoke(rCode);
66
+ });
67
+ });
68
+ }
69
+
70
+ function doRevoke(rCode) {
71
+ community.disableTwoFactor('R' + rCode, (err) => {
72
+ if (err) {
73
+ console.log(err);
74
+ process.exit();
75
+ return;
76
+ }
77
+
78
+ console.log('Two-factor authentication disabled!');
79
+ process.exit();
80
+ });
81
+ }
@@ -1,118 +1,118 @@
1
- var SteamCommunity = require('../index.js');
2
- var ReadLine = require('readline');
3
-
4
- var community = new SteamCommunity();
5
- var rl = ReadLine.createInterface({
6
- "input": process.stdin,
7
- "output": process.stdout
8
- });
9
-
10
- rl.question("Username: ", function(accountName) {
11
- rl.question("Password: ", function(password) {
12
- doLogin(accountName, password);
13
- });
14
- });
15
-
16
- function doLogin(accountName, password, authCode, twoFactorCode, captcha) {
17
- community.login({
18
- "accountName": accountName,
19
- "password": password,
20
- "authCode": authCode,
21
- "twoFactorCode": twoFactorCode,
22
- "captcha": captcha
23
- }, function(err, sessionID, cookies, steamguard) {
24
- if(err) {
25
- if(err.message == 'SteamGuardMobile') {
26
- rl.question("Steam Authenticator Code: ", function(code) {
27
- doLogin(accountName, password, null, code);
28
- });
29
-
30
- return;
31
- }
32
-
33
- if(err.message == 'SteamGuard') {
34
- console.log("An email has been sent to your address at " + err.emaildomain);
35
- rl.question("Steam Guard Code: ", function(code) {
36
- doLogin(accountName, password, code);
37
- });
38
-
39
- return;
40
- }
41
-
42
- if(err.message == 'CAPTCHA') {
43
- console.log(err.captchaurl);
44
- rl.question("CAPTCHA: ", function(captchaInput) {
45
- doLogin(accountName, password, authCode, twoFactorCode, captchaInput);
46
- });
47
-
48
- return;
49
- }
50
-
51
- console.log(err);
52
- process.exit();
53
- return;
54
- }
55
-
56
- console.log("Logged on!");
57
-
58
- rl.question("Group ID: ", function(gid) {
59
- community.getSteamGroup(gid, function(err, group) {
60
- if (err) {
61
- console.log(err);
62
- process.exit(1);
63
- }
64
-
65
- group.getAllAnnouncements(function(err, announcements) {
66
-
67
- if(announcements.length === 0) {
68
- return console.log("This group has no announcements");
69
- }
70
-
71
- for (var i = announcements.length - 1; i >= 0; i--) {
72
- console.log("[%s] %s %s: %s", announcements[i].date, announcements[i].aid, announcements[i].author, announcements[i].content);
73
- };
74
-
75
- rl.question("Would you like to delete delete or edit an annoucement? (Type edit/delete): ", function(choice) {
76
- rl.question("Annoucement ID: ", function(aid) {
77
- if(choice === 'edit') {
78
- rl.question("New title: ", function(header) {
79
- rl.question("New body: ", function(content) {
80
- // EW THE PYRAMID!
81
- // Try replace this with delete!
82
- editAnnouncement(group, aid, header, content);
83
- });
84
- });
85
- } else {
86
- deleteAnnouncement(group, aid);
87
- }
88
- });
89
- });
90
- });
91
- });
92
- });
93
- });
94
- }
95
-
96
- function editAnnouncement(group, aid, header, content) {
97
- // Actual community method.
98
- group.editAnnouncement(aid, header, content, function(error) {
99
- if(!error) {
100
- console.log("Annoucement edited!");
101
- } else {
102
- console.log("Unable to edit annoucement! %j", error);
103
- process.exit(1);
104
- }
105
- });
106
- }
107
-
108
- function deleteAnnouncement(group, aid) {
109
- // group.deleteAnnouncement(aid);
110
- // Or
111
- group.deleteAnnouncement(aid, function(err) {
112
- if(!err) {
113
- console.log("Deleted");
114
- } else {
115
- console.log("Error deleting announcement.");
116
- }
117
- })
118
- }
1
+ var SteamCommunity = require('../index.js');
2
+ var ReadLine = require('readline');
3
+
4
+ var community = new SteamCommunity();
5
+ var rl = ReadLine.createInterface({
6
+ "input": process.stdin,
7
+ "output": process.stdout
8
+ });
9
+
10
+ rl.question("Username: ", function(accountName) {
11
+ rl.question("Password: ", function(password) {
12
+ doLogin(accountName, password);
13
+ });
14
+ });
15
+
16
+ function doLogin(accountName, password, authCode, twoFactorCode, captcha) {
17
+ community.login({
18
+ "accountName": accountName,
19
+ "password": password,
20
+ "authCode": authCode,
21
+ "twoFactorCode": twoFactorCode,
22
+ "captcha": captcha
23
+ }, function(err, sessionID, cookies, steamguard) {
24
+ if(err) {
25
+ if(err.message == 'SteamGuardMobile') {
26
+ rl.question("Steam Authenticator Code: ", function(code) {
27
+ doLogin(accountName, password, null, code);
28
+ });
29
+
30
+ return;
31
+ }
32
+
33
+ if(err.message == 'SteamGuard') {
34
+ console.log("An email has been sent to your address at " + err.emaildomain);
35
+ rl.question("Steam Guard Code: ", function(code) {
36
+ doLogin(accountName, password, code);
37
+ });
38
+
39
+ return;
40
+ }
41
+
42
+ if(err.message == 'CAPTCHA') {
43
+ console.log(err.captchaurl);
44
+ rl.question("CAPTCHA: ", function(captchaInput) {
45
+ doLogin(accountName, password, authCode, twoFactorCode, captchaInput);
46
+ });
47
+
48
+ return;
49
+ }
50
+
51
+ console.log(err);
52
+ process.exit();
53
+ return;
54
+ }
55
+
56
+ console.log("Logged on!");
57
+
58
+ rl.question("Group ID: ", function(gid) {
59
+ community.getSteamGroup(gid, function(err, group) {
60
+ if (err) {
61
+ console.log(err);
62
+ process.exit(1);
63
+ }
64
+
65
+ group.getAllAnnouncements(function(err, announcements) {
66
+
67
+ if(announcements.length === 0) {
68
+ return console.log("This group has no announcements");
69
+ }
70
+
71
+ for (var i = announcements.length - 1; i >= 0; i--) {
72
+ console.log("[%s] %s %s: %s", announcements[i].date, announcements[i].aid, announcements[i].author, announcements[i].content);
73
+ };
74
+
75
+ rl.question("Would you like to delete delete or edit an annoucement? (Type edit/delete): ", function(choice) {
76
+ rl.question("Annoucement ID: ", function(aid) {
77
+ if(choice === 'edit') {
78
+ rl.question("New title: ", function(header) {
79
+ rl.question("New body: ", function(content) {
80
+ // EW THE PYRAMID!
81
+ // Try replace this with delete!
82
+ editAnnouncement(group, aid, header, content);
83
+ });
84
+ });
85
+ } else {
86
+ deleteAnnouncement(group, aid);
87
+ }
88
+ });
89
+ });
90
+ });
91
+ });
92
+ });
93
+ });
94
+ }
95
+
96
+ function editAnnouncement(group, aid, header, content) {
97
+ // Actual community method.
98
+ group.editAnnouncement(aid, header, content, function(error) {
99
+ if(!error) {
100
+ console.log("Annoucement edited!");
101
+ } else {
102
+ console.log("Unable to edit annoucement! %j", error);
103
+ process.exit(1);
104
+ }
105
+ });
106
+ }
107
+
108
+ function deleteAnnouncement(group, aid) {
109
+ // group.deleteAnnouncement(aid);
110
+ // Or
111
+ group.deleteAnnouncement(aid, function(err) {
112
+ if(!err) {
113
+ console.log("Deleted");
114
+ } else {
115
+ console.log("Error deleting announcement.");
116
+ }
117
+ })
118
+ }
@@ -1,131 +1,131 @@
1
- // If you aren't running this script inside of the repository, replace the following line with:
2
- // const SteamCommunity = require('steamcommunity');
3
- const SteamCommunity = require('../index.js');
4
- const ReadLine = require('readline');
5
- const FS = require('fs');
6
-
7
- const EResult = SteamCommunity.EResult;
8
-
9
- let community = new SteamCommunity();
10
- let rl = ReadLine.createInterface({
11
- input: process.stdin,
12
- output: process.stdout
13
- });
14
-
15
- rl.question('Username: ', (accountName) => {
16
- rl.question('Password: ', (password) => {
17
- doLogin(accountName, password);
18
- });
19
- });
20
-
21
- function doLogin(accountName, password, authCode, captcha) {
22
- community.login({
23
- accountName: accountName,
24
- password: password,
25
- authCode: authCode,
26
- captcha: captcha
27
- }, (err, sessionID, cookies, steamguard) => {
28
- if (err) {
29
- if (err.message == 'SteamGuardMobile') {
30
- console.log('This account already has two-factor authentication enabled.');
31
- process.exit();
32
- return;
33
- }
34
-
35
- if (err.message == 'SteamGuard') {
36
- console.log(`An email has been sent to your address at ${err.emaildomain}`);
37
- rl.question('Steam Guard Code: ', (code) => {
38
- doLogin(accountName, password, code);
39
- });
40
-
41
- return;
42
- }
43
-
44
- if (err.message == 'CAPTCHA') {
45
- console.log(err.captchaurl);
46
- rl.question('CAPTCHA: ', (captchaInput) => {
47
- doLogin(accountName, password, authCode, captchaInput);
48
- });
49
-
50
- return;
51
- }
52
-
53
- console.log(err);
54
- process.exit();
55
- return;
56
- }
57
-
58
- console.log('Logged on!');
59
-
60
- if (community.mobileAccessToken) {
61
- // If we already have a mobile access token, we don't need to prompt for one.
62
- doSetup();
63
- return;
64
- }
65
-
66
- console.log('You need to provide a mobile app access token to continue.');
67
- console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
68
- console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
69
- console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
70
-
71
- rl.question('Access Token: ', (accessToken) => {
72
- community.setMobileAppAccessToken(accessToken);
73
- doSetup();
74
- });
75
- });
76
- }
77
-
78
- function doSetup() {
79
- community.enableTwoFactor((err, response) => {
80
- if (err) {
81
- if (err.eresult == EResult.Fail) {
82
- console.log('Error: Failed to enable two-factor authentication. Do you have a phone number attached to your account?');
83
- process.exit();
84
- return;
85
- }
86
-
87
- if (err.eresult == EResult.RateLimitExceeded) {
88
- console.log('Error: RateLimitExceeded. Try again later.');
89
- process.exit();
90
- return;
91
- }
92
-
93
- console.log(err);
94
- process.exit();
95
- return;
96
- }
97
-
98
- if (response.status != EResult.OK) {
99
- console.log(`Error: Status ${response.status}`);
100
- process.exit();
101
- return;
102
- }
103
-
104
- let filename = `twofactor_${community.steamID.getSteamID64()}.json`;
105
- console.log(`Writing secrets to ${filename}`);
106
- console.log(`Revocation code: ${response.revocation_code}`);
107
- FS.writeFileSync(filename, JSON.stringify(response, null, '\t'));
108
-
109
- promptActivationCode(response);
110
- });
111
- }
112
-
113
- function promptActivationCode(response) {
114
- rl.question('SMS Code: ', (smsCode) => {
115
- community.finalizeTwoFactor(response.shared_secret, smsCode, (err) => {
116
- if (err) {
117
- if (err.message == 'Invalid activation code') {
118
- console.log(err);
119
- promptActivationCode(response);
120
- return;
121
- }
122
-
123
- console.log(err);
124
- } else {
125
- console.log('Two-factor authentication enabled!');
126
- }
127
-
128
- process.exit();
129
- });
130
- });
131
- }
1
+ // If you aren't running this script inside of the repository, replace the following line with:
2
+ // const SteamCommunity = require('steamcommunity');
3
+ const SteamCommunity = require('../index.js');
4
+ const ReadLine = require('readline');
5
+ const FS = require('fs');
6
+
7
+ const EResult = SteamCommunity.EResult;
8
+
9
+ let community = new SteamCommunity();
10
+ let rl = ReadLine.createInterface({
11
+ input: process.stdin,
12
+ output: process.stdout
13
+ });
14
+
15
+ rl.question('Username: ', (accountName) => {
16
+ rl.question('Password: ', (password) => {
17
+ doLogin(accountName, password);
18
+ });
19
+ });
20
+
21
+ function doLogin(accountName, password, authCode, captcha) {
22
+ community.login({
23
+ accountName: accountName,
24
+ password: password,
25
+ authCode: authCode,
26
+ captcha: captcha
27
+ }, (err, sessionID, cookies, steamguard) => {
28
+ if (err) {
29
+ if (err.message == 'SteamGuardMobile') {
30
+ console.log('This account already has two-factor authentication enabled.');
31
+ process.exit();
32
+ return;
33
+ }
34
+
35
+ if (err.message == 'SteamGuard') {
36
+ console.log(`An email has been sent to your address at ${err.emaildomain}`);
37
+ rl.question('Steam Guard Code: ', (code) => {
38
+ doLogin(accountName, password, code);
39
+ });
40
+
41
+ return;
42
+ }
43
+
44
+ if (err.message == 'CAPTCHA') {
45
+ console.log(err.captchaurl);
46
+ rl.question('CAPTCHA: ', (captchaInput) => {
47
+ doLogin(accountName, password, authCode, captchaInput);
48
+ });
49
+
50
+ return;
51
+ }
52
+
53
+ console.log(err);
54
+ process.exit();
55
+ return;
56
+ }
57
+
58
+ console.log('Logged on!');
59
+
60
+ if (community.mobileAccessToken) {
61
+ // If we already have a mobile access token, we don't need to prompt for one.
62
+ doSetup();
63
+ return;
64
+ }
65
+
66
+ console.log('You need to provide a mobile app access token to continue.');
67
+ console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
68
+ console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
69
+ console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
70
+
71
+ rl.question('Access Token: ', (accessToken) => {
72
+ community.setMobileAppAccessToken(accessToken);
73
+ doSetup();
74
+ });
75
+ });
76
+ }
77
+
78
+ function doSetup() {
79
+ community.enableTwoFactor((err, response) => {
80
+ if (err) {
81
+ if (err.eresult == EResult.Fail) {
82
+ console.log('Error: Failed to enable two-factor authentication. Do you have a phone number attached to your account?');
83
+ process.exit();
84
+ return;
85
+ }
86
+
87
+ if (err.eresult == EResult.RateLimitExceeded) {
88
+ console.log('Error: RateLimitExceeded. Try again later.');
89
+ process.exit();
90
+ return;
91
+ }
92
+
93
+ console.log(err);
94
+ process.exit();
95
+ return;
96
+ }
97
+
98
+ if (response.status != EResult.OK) {
99
+ console.log(`Error: Status ${response.status}`);
100
+ process.exit();
101
+ return;
102
+ }
103
+
104
+ let filename = `twofactor_${community.steamID.getSteamID64()}.json`;
105
+ console.log(`Writing secrets to ${filename}`);
106
+ console.log(`Revocation code: ${response.revocation_code}`);
107
+ FS.writeFileSync(filename, JSON.stringify(response, null, '\t'));
108
+
109
+ promptActivationCode(response);
110
+ });
111
+ }
112
+
113
+ function promptActivationCode(response) {
114
+ rl.question('SMS Code: ', (smsCode) => {
115
+ community.finalizeTwoFactor(response.shared_secret, smsCode, (err) => {
116
+ if (err) {
117
+ if (err.message == 'Invalid activation code') {
118
+ console.log(err);
119
+ promptActivationCode(response);
120
+ return;
121
+ }
122
+
123
+ console.log(err);
124
+ } else {
125
+ console.log('Two-factor authentication enabled!');
126
+ }
127
+
128
+ process.exit();
129
+ });
130
+ });
131
+ }