steamcommunity 3.46.1 → 3.47.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.
Files changed (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +22 -22
  3. package/classes/CConfirmation.js +37 -37
  4. package/classes/CEconItem.js +120 -120
  5. package/classes/CMarketItem.js +189 -189
  6. package/classes/CMarketSearchResult.js +89 -89
  7. package/classes/CSteamGroup.js +155 -155
  8. package/classes/CSteamUser.js +225 -217
  9. package/components/chat.js +283 -283
  10. package/components/confirmations.js +428 -428
  11. package/components/groups.js +798 -732
  12. package/components/help.js +64 -64
  13. package/components/helpers.js +128 -108
  14. package/components/http.js +150 -150
  15. package/components/inventoryhistory.js +173 -173
  16. package/components/login.js +110 -0
  17. package/components/market.js +387 -387
  18. package/components/profile.js +475 -475
  19. package/components/twofactor.js +152 -152
  20. package/components/users.js +831 -767
  21. package/components/webapi.js +118 -118
  22. package/examples/README.md +35 -35
  23. package/examples/accept_all_confirmations.js +173 -173
  24. package/examples/disable_twofactor.js +135 -135
  25. package/examples/edit-group-announcement.js +118 -118
  26. package/examples/enable_twofactor.js +182 -182
  27. package/index.js +13 -151
  28. package/package.json +11 -6
  29. package/resources/EChatState.js +14 -14
  30. package/resources/EConfirmationType.js +12 -12
  31. package/resources/EFriendRelationship.js +23 -23
  32. package/resources/EPersonaState.js +23 -23
  33. package/resources/EPersonaStateFlag.js +32 -32
  34. package/resources/EResult.js +254 -254
  35. package/.editorconfig +0 -13
  36. package/.github/FUNDING.yml +0 -2
  37. package/.idea/.name +0 -1
  38. package/.idea/codeStyleSettings.xml +0 -13
  39. package/.idea/codeStyles/Project.xml +0 -15
  40. package/.idea/codeStyles/codeStyleConfig.xml +0 -6
  41. package/.idea/copyright/profiles_settings.xml +0 -3
  42. package/.idea/encodings.xml +0 -6
  43. package/.idea/inspectionProfiles/Project_Default.xml +0 -11
  44. package/.idea/jsLibraryMappings.xml +0 -6
  45. package/.idea/misc.xml +0 -6
  46. package/.idea/modules.xml +0 -9
  47. package/.idea/node-steamcommunity.iml +0 -8
  48. package/.idea/steamcommunity.iml +0 -10
  49. package/.idea/vcs.xml +0 -7
  50. package/.idea/watcherTasks.xml +0 -4
  51. package/CONTRIBUTING.md +0 -36
@@ -1,155 +1,155 @@
1
- var SteamCommunity = require('../index.js');
2
- var Helpers = require('../components/helpers.js');
3
- var SteamID = require('steamid');
4
- var xml2js = require('xml2js');
5
-
6
- SteamCommunity.prototype.getSteamGroup = function(id, callback) {
7
- if(typeof id !== 'string' && !Helpers.isSteamID(id)) {
8
- throw new Error("id parameter should be a group URL string or a SteamID object");
9
- }
10
-
11
- if(typeof id === 'object' && (id.universe != SteamID.Universe.PUBLIC || id.type != SteamID.Type.CLAN)) {
12
- throw new Error("SteamID must stand for a clan account in the public universe");
13
- }
14
-
15
- var self = this;
16
- this.httpRequest("https://steamcommunity.com/" + (typeof id === 'string' ? "groups/" + id : "gid/" + id.toString()) + "/memberslistxml/?xml=1", function(err, response, body) {
17
- if (err) {
18
- callback(err);
19
- return;
20
- }
21
-
22
- xml2js.parseString(body, function(err, result) {
23
- if(err) {
24
- callback(err);
25
- return;
26
- }
27
-
28
- callback(null, new CSteamGroup(self, result.memberList));
29
- });
30
- }, "steamcommunity");
31
- };
32
-
33
- function CSteamGroup(community, groupData) {
34
- this._community = community;
35
-
36
- this.steamID = new SteamID(groupData.groupID64[0]);
37
- this.name = groupData.groupDetails[0].groupName[0];
38
- this.url = groupData.groupDetails[0].groupURL[0];
39
- this.headline = groupData.groupDetails[0].headline[0];
40
- this.summary = groupData.groupDetails[0].summary[0];
41
- this.avatarHash = groupData.groupDetails[0].avatarIcon[0].match(/([0-9a-f]+)\.jpg$/)[1];
42
- this.members = parseInt(groupData.groupDetails[0].memberCount[0], 10);
43
- this.membersInChat = parseInt(groupData.groupDetails[0].membersInChat[0], 10);
44
- this.membersInGame = parseInt(groupData.groupDetails[0].membersInGame[0], 10);
45
- this.membersOnline = parseInt(groupData.groupDetails[0].membersOnline[0], 10);
46
- }
47
-
48
- CSteamGroup.prototype.getAvatarURL = function(size, protocol) {
49
- size = size || '';
50
- protocol = protocol || 'http://';
51
-
52
- var url = protocol + "steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/" + this.avatarHash.substring(0, 2) + "/" + this.avatarHash;
53
- if(size == 'full' || size == 'medium') {
54
- return url + "_" + size + ".jpg";
55
- } else {
56
- return url + ".jpg";
57
- }
58
- };
59
-
60
- CSteamGroup.prototype.getMembers = function(addresses, callback) {
61
- if(typeof addresses === 'function') {
62
- callback = addresses;
63
- addresses = null;
64
- }
65
-
66
- this._community.getGroupMembers(this.steamID, callback, null, null, addresses, 0);
67
- };
68
-
69
- CSteamGroup.prototype.join = function(callback) {
70
- this._community.joinGroup(this.steamID, callback);
71
- };
72
-
73
- CSteamGroup.prototype.leave = function(callback) {
74
- this._community.leaveGroup(this.steamID, callback);
75
- };
76
-
77
- CSteamGroup.prototype.getAllAnnouncements = function(time, callback) {
78
- this._community.getAllGroupAnnouncements(this.steamID, time, callback);
79
- };
80
-
81
- CSteamGroup.prototype.postAnnouncement = function(headline, content, hidden, callback) {
82
- this._community.postGroupAnnouncement(this.steamID, headline, content, hidden, callback);
83
- };
84
-
85
- CSteamGroup.prototype.editAnnouncement = function(annoucementID, headline, content, callback) {
86
- this._community.editGroupAnnouncement(this.steamID, annoucementID, headline, content, callback)
87
- };
88
-
89
- CSteamGroup.prototype.deleteAnnouncement = function(annoucementID, callback) {
90
- this._community.deleteGroupAnnouncement(this.steamID, annoucementID, callback)
91
- };
92
-
93
- CSteamGroup.prototype.scheduleEvent = function(name, type, description, time, server, callback) {
94
- this._community.scheduleGroupEvent(this.steamID, name, type, description, time, server, callback);
95
- };
96
-
97
- CSteamGroup.prototype.editEvent = function(id, name, type, description, time, server, callback) {
98
- this._community.editGroupEvent(this.steamID, id, name, type, description, time, server, callback);
99
- };
100
-
101
- CSteamGroup.prototype.deleteEvent = function (id, callback) {
102
- this._community.deleteGroupEvent(this.steamID, id, callback);
103
- };
104
-
105
- CSteamGroup.prototype.setPlayerOfTheWeek = function(steamID, callback) {
106
- this._community.setGroupPlayerOfTheWeek(this.steamID, steamID, callback);
107
- };
108
-
109
- CSteamGroup.prototype.kick = function(steamID, callback) {
110
- this._community.kickGroupMember(this.steamID, steamID, callback);
111
- };
112
-
113
- CSteamGroup.prototype.getHistory = function(page, callback) {
114
- this._community.getGroupHistory(this.steamID, page, callback);
115
- };
116
-
117
-
118
- CSteamGroup.prototype.getAllComments = function(from, count, callback) {
119
- this._community.getAllGroupComments(this.steamID, from, count, callback);
120
- };
121
-
122
- CSteamGroup.prototype.deleteComment = function(cid, callback) {
123
- this._community.deleteGroupComment(this.steamID, cid, callback);
124
- };
125
-
126
- CSteamGroup.prototype.comment = function(message, callback) {
127
- this._community.postGroupComment(this.steamID, message, callback);
128
- };
129
-
130
- /**
131
- * Get requests to join this restricted group.
132
- * @param {function} callback - First argument is null/Error, second is array of SteamID objects
133
- */
134
- CSteamGroup.prototype.getJoinRequests = function(callback) {
135
- this._community.getGroupJoinRequests(this.steamID, callback);
136
- };
137
-
138
- /**
139
- * Respond to one or more join requests to this restricted group.
140
- * @param {SteamID|string|SteamID[]|string[]} steamIDs - The SteamIDs of the users you want to approve or deny membership for (or a single value)
141
- * @param {boolean} approve - True to put them in the group, false to deny their membership
142
- * @param {function} callback - Takes only an Error object/null as the first argument
143
- */
144
- CSteamGroup.prototype.respondToJoinRequests = function(steamIDs, approve, callback) {
145
- this._community.respondToGroupJoinRequests(this.steamID, steamIDs, approve, callback);
146
- };
147
-
148
- /**
149
- * Respond to *ALL* pending group-join requests for this group.
150
- * @param {boolean} approve - True to allow everyone who requested into the group, false to not
151
- * @param {function} callback - Takes only an Error object/null as the first argument
152
- */
153
- CSteamGroup.prototype.respondToAllJoinRequests = function(approve, callback) {
154
- this._community.respondToAllGroupJoinRequests(this.steamID, approve, callback);
155
- };
1
+ var SteamCommunity = require('../index.js');
2
+ var Helpers = require('../components/helpers.js');
3
+ var SteamID = require('steamid');
4
+ var xml2js = require('xml2js');
5
+
6
+ SteamCommunity.prototype.getSteamGroup = function(id, callback) {
7
+ if(typeof id !== 'string' && !Helpers.isSteamID(id)) {
8
+ throw new Error("id parameter should be a group URL string or a SteamID object");
9
+ }
10
+
11
+ if(typeof id === 'object' && (id.universe != SteamID.Universe.PUBLIC || id.type != SteamID.Type.CLAN)) {
12
+ throw new Error("SteamID must stand for a clan account in the public universe");
13
+ }
14
+
15
+ var self = this;
16
+ this.httpRequest("https://steamcommunity.com/" + (typeof id === 'string' ? "groups/" + id : "gid/" + id.toString()) + "/memberslistxml/?xml=1", function(err, response, body) {
17
+ if (err) {
18
+ callback(err);
19
+ return;
20
+ }
21
+
22
+ xml2js.parseString(body, function(err, result) {
23
+ if(err) {
24
+ callback(err);
25
+ return;
26
+ }
27
+
28
+ callback(null, new CSteamGroup(self, result.memberList));
29
+ });
30
+ }, "steamcommunity");
31
+ };
32
+
33
+ function CSteamGroup(community, groupData) {
34
+ this._community = community;
35
+
36
+ this.steamID = new SteamID(groupData.groupID64[0]);
37
+ this.name = groupData.groupDetails[0].groupName[0];
38
+ this.url = groupData.groupDetails[0].groupURL[0];
39
+ this.headline = groupData.groupDetails[0].headline[0];
40
+ this.summary = groupData.groupDetails[0].summary[0];
41
+ this.avatarHash = groupData.groupDetails[0].avatarIcon[0].match(/([0-9a-f]+)\.jpg$/)[1];
42
+ this.members = parseInt(groupData.groupDetails[0].memberCount[0], 10);
43
+ this.membersInChat = parseInt(groupData.groupDetails[0].membersInChat[0], 10);
44
+ this.membersInGame = parseInt(groupData.groupDetails[0].membersInGame[0], 10);
45
+ this.membersOnline = parseInt(groupData.groupDetails[0].membersOnline[0], 10);
46
+ }
47
+
48
+ CSteamGroup.prototype.getAvatarURL = function(size, protocol) {
49
+ size = size || '';
50
+ protocol = protocol || 'http://';
51
+
52
+ var url = protocol + "steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/" + this.avatarHash.substring(0, 2) + "/" + this.avatarHash;
53
+ if(size == 'full' || size == 'medium') {
54
+ return url + "_" + size + ".jpg";
55
+ } else {
56
+ return url + ".jpg";
57
+ }
58
+ };
59
+
60
+ CSteamGroup.prototype.getMembers = function(addresses, callback) {
61
+ if(typeof addresses === 'function') {
62
+ callback = addresses;
63
+ addresses = null;
64
+ }
65
+
66
+ this._community.getGroupMembers(this.steamID, callback, null, null, addresses, 0);
67
+ };
68
+
69
+ CSteamGroup.prototype.join = function(callback) {
70
+ this._community.joinGroup(this.steamID, callback);
71
+ };
72
+
73
+ CSteamGroup.prototype.leave = function(callback) {
74
+ this._community.leaveGroup(this.steamID, callback);
75
+ };
76
+
77
+ CSteamGroup.prototype.getAllAnnouncements = function(time, callback) {
78
+ this._community.getAllGroupAnnouncements(this.steamID, time, callback);
79
+ };
80
+
81
+ CSteamGroup.prototype.postAnnouncement = function(headline, content, hidden, callback) {
82
+ this._community.postGroupAnnouncement(this.steamID, headline, content, hidden, callback);
83
+ };
84
+
85
+ CSteamGroup.prototype.editAnnouncement = function(annoucementID, headline, content, callback) {
86
+ this._community.editGroupAnnouncement(this.steamID, annoucementID, headline, content, callback)
87
+ };
88
+
89
+ CSteamGroup.prototype.deleteAnnouncement = function(annoucementID, callback) {
90
+ this._community.deleteGroupAnnouncement(this.steamID, annoucementID, callback)
91
+ };
92
+
93
+ CSteamGroup.prototype.scheduleEvent = function(name, type, description, time, server, callback) {
94
+ this._community.scheduleGroupEvent(this.steamID, name, type, description, time, server, callback);
95
+ };
96
+
97
+ CSteamGroup.prototype.editEvent = function(id, name, type, description, time, server, callback) {
98
+ this._community.editGroupEvent(this.steamID, id, name, type, description, time, server, callback);
99
+ };
100
+
101
+ CSteamGroup.prototype.deleteEvent = function (id, callback) {
102
+ this._community.deleteGroupEvent(this.steamID, id, callback);
103
+ };
104
+
105
+ CSteamGroup.prototype.setPlayerOfTheWeek = function(steamID, callback) {
106
+ this._community.setGroupPlayerOfTheWeek(this.steamID, steamID, callback);
107
+ };
108
+
109
+ CSteamGroup.prototype.kick = function(steamID, callback) {
110
+ this._community.kickGroupMember(this.steamID, steamID, callback);
111
+ };
112
+
113
+ CSteamGroup.prototype.getHistory = function(page, callback) {
114
+ this._community.getGroupHistory(this.steamID, page, callback);
115
+ };
116
+
117
+
118
+ CSteamGroup.prototype.getAllComments = function(from, count, callback) {
119
+ this._community.getAllGroupComments(this.steamID, from, count, callback);
120
+ };
121
+
122
+ CSteamGroup.prototype.deleteComment = function(cid, callback) {
123
+ this._community.deleteGroupComment(this.steamID, cid, callback);
124
+ };
125
+
126
+ CSteamGroup.prototype.comment = function(message, callback) {
127
+ this._community.postGroupComment(this.steamID, message, callback);
128
+ };
129
+
130
+ /**
131
+ * Get requests to join this restricted group.
132
+ * @param {function} callback - First argument is null/Error, second is array of SteamID objects
133
+ */
134
+ CSteamGroup.prototype.getJoinRequests = function(callback) {
135
+ this._community.getGroupJoinRequests(this.steamID, callback);
136
+ };
137
+
138
+ /**
139
+ * Respond to one or more join requests to this restricted group.
140
+ * @param {SteamID|string|SteamID[]|string[]} steamIDs - The SteamIDs of the users you want to approve or deny membership for (or a single value)
141
+ * @param {boolean} approve - True to put them in the group, false to deny their membership
142
+ * @param {function} callback - Takes only an Error object/null as the first argument
143
+ */
144
+ CSteamGroup.prototype.respondToJoinRequests = function(steamIDs, approve, callback) {
145
+ this._community.respondToGroupJoinRequests(this.steamID, steamIDs, approve, callback);
146
+ };
147
+
148
+ /**
149
+ * Respond to *ALL* pending group-join requests for this group.
150
+ * @param {boolean} approve - True to allow everyone who requested into the group, false to not
151
+ * @param {function} callback - Takes only an Error object/null as the first argument
152
+ */
153
+ CSteamGroup.prototype.respondToAllJoinRequests = function(approve, callback) {
154
+ this._community.respondToAllGroupJoinRequests(this.steamID, approve, callback);
155
+ };