steamcommunity 3.47.1 → 3.48.0

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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Alex Corn
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Alex Corn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,22 +1,22 @@
1
- # Steam Community for Node.js
2
- [![npm version](https://img.shields.io/npm/v/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
3
- [![npm downloads](https://img.shields.io/npm/dm/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
4
- [![license](https://img.shields.io/npm/l/steamcommunity.svg)](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
5
- [![paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity&currency_code=USD)
6
-
7
- This module provides an easy interface for the Steam Community website. This module can be used to simply login to steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
8
-
9
- It supports Steam Guard and CAPTCHAs.
10
-
11
- **Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
12
- requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
13
- Such issues may be ignored!**
14
-
15
- # Documentation
16
-
17
- Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
18
-
19
- # Support
20
-
21
- Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
22
- on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
1
+ # Steam Community for Node.js
2
+ [![npm version](https://img.shields.io/npm/v/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
3
+ [![npm downloads](https://img.shields.io/npm/dm/steamcommunity.svg)](https://npmjs.com/package/steamcommunity)
4
+ [![license](https://img.shields.io/npm/l/steamcommunity.svg)](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
5
+ [![paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity&currency_code=USD)
6
+
7
+ This module provides an easy interface for the Steam Community website. This module can be used to simply login to steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
8
+
9
+ It supports Steam Guard and CAPTCHAs.
10
+
11
+ **Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
12
+ requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
13
+ Such issues may be ignored!**
14
+
15
+ # Documentation
16
+
17
+ Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
18
+
19
+ # Support
20
+
21
+ Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
22
+ on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
@@ -1,37 +1,37 @@
1
- var SteamCommunity = require('../index.js');
2
-
3
- module.exports = CConfirmation;
4
-
5
- function CConfirmation(community, data) {
6
- Object.defineProperty(this, '_community', {value: community});
7
-
8
- this.id = data.id.toString();
9
- this.type = data.type;
10
- this.creator = data.creator.toString();
11
- this.key = data.key;
12
- this.title = data.title;
13
- this.receiving = data.receiving;
14
- this.sending = data.sending;
15
- this.time = data.time;
16
- this.timestamp = data.timestamp;
17
- this.icon = data.icon;
18
- this.offerID = this.type == SteamCommunity.ConfirmationType.Trade ? this.creator : null;
19
- }
20
-
21
- CConfirmation.prototype.getOfferID = function(time, key, callback) {
22
- if (this.type && this.creator) {
23
- if (this.type != SteamCommunity.ConfirmationType.Trade) {
24
- callback(new Error('Not a trade confirmation'));
25
- return;
26
- }
27
-
28
- callback(null, this.creator);
29
- return;
30
- }
31
-
32
- this._community.getConfirmationOfferID(this.id, time, key, callback);
33
- };
34
-
35
- CConfirmation.prototype.respond = function(time, key, accept, callback) {
36
- this._community.respondToConfirmation(this.id, this.key, time, key, accept, callback);
37
- };
1
+ var SteamCommunity = require('../index.js');
2
+
3
+ module.exports = CConfirmation;
4
+
5
+ function CConfirmation(community, data) {
6
+ Object.defineProperty(this, '_community', {value: community});
7
+
8
+ this.id = data.id.toString();
9
+ this.type = data.type;
10
+ this.creator = data.creator.toString();
11
+ this.key = data.key;
12
+ this.title = data.title;
13
+ this.receiving = data.receiving;
14
+ this.sending = data.sending;
15
+ this.time = data.time;
16
+ this.timestamp = data.timestamp;
17
+ this.icon = data.icon;
18
+ this.offerID = this.type == SteamCommunity.ConfirmationType.Trade ? this.creator : null;
19
+ }
20
+
21
+ CConfirmation.prototype.getOfferID = function(time, key, callback) {
22
+ if (this.type && this.creator) {
23
+ if (this.type != SteamCommunity.ConfirmationType.Trade) {
24
+ callback(new Error('Not a trade confirmation'));
25
+ return;
26
+ }
27
+
28
+ callback(null, this.creator);
29
+ return;
30
+ }
31
+
32
+ this._community.getConfirmationOfferID(this.id, time, key, callback);
33
+ };
34
+
35
+ CConfirmation.prototype.respond = function(time, key, accept, callback) {
36
+ this._community.respondToConfirmation(this.id, this.key, time, key, accept, callback);
37
+ };
@@ -1,120 +1,120 @@
1
- module.exports = CEconItem;
2
-
3
- function CEconItem(item, description, contextID) {
4
- var thing;
5
- for (thing in item) {
6
- if (item.hasOwnProperty(thing)) {
7
- this[thing] = item[thing];
8
- }
9
- }
10
-
11
- var isCurrency = !!(this.is_currency || this.currency) || typeof this.currencyid !== 'undefined'; // I don't want to put this on the object yet; it's nice to have the ids at the top of printed output
12
-
13
- if (isCurrency) {
14
- this.currencyid = this.id = (this.id || this.currencyid);
15
- } else {
16
- this.assetid = this.id = (this.id || this.assetid);
17
- }
18
-
19
- this.instanceid = this.instanceid || '0';
20
- this.amount = parseInt(this.amount, 10);
21
- this.contextid = this.contextid || contextID.toString();
22
-
23
- // Merge the description
24
- if (description) {
25
- // Is this a listing of descriptions?
26
- if (description[this.classid + '_' + this.instanceid]) {
27
- description = description[this.classid + '_' + this.instanceid];
28
- }
29
-
30
- for (thing in description) {
31
- if (description.hasOwnProperty(thing)) {
32
- this[thing] = description[thing];
33
- }
34
- }
35
- }
36
-
37
- this.is_currency = isCurrency;
38
- this.tradable = !!this.tradable;
39
- this.marketable = !!this.marketable;
40
- this.commodity = !!this.commodity;
41
- this.market_tradable_restriction = (this.market_tradable_restriction ? parseInt(this.market_tradable_restriction, 10) : 0);
42
- this.market_marketable_restriction = (this.market_marketable_restriction ? parseInt(this.market_marketable_restriction, 10) : 0);
43
- this.fraudwarnings = this.fraudwarnings || [];
44
- this.descriptions = this.descriptions || [];
45
-
46
- if (this.owner && JSON.stringify(this.owner) == '{}') {
47
- this.owner = null;
48
- }
49
-
50
- // Restore old property names of tags
51
- if (this.tags) {
52
- this.tags = this.tags.map(function(tag) {
53
- return {
54
- "internal_name": tag.internal_name,
55
- "name": tag.localized_tag_name || tag.name,
56
- "category": tag.category,
57
- "color": tag.color || "",
58
- "category_name": tag.localized_category_name || tag.category_name
59
- };
60
- });
61
- }
62
-
63
- // Restore market_fee_app, if applicable
64
- var match;
65
- if (this.appid == 753 && this.contextid == 6 && this.market_hash_name && (match = this.market_hash_name.match(/^(\d+)\-/))) {
66
- this.market_fee_app = parseInt(match[1], 10);
67
- }
68
-
69
- // Restore cache_expiration, if we can (for CS:GO items)
70
- if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
71
- let description = this.owner_descriptions.find(d => d.value && d.value.indexOf('Tradable After ') == 0);
72
- if (description) {
73
- let date = new Date(description.value.substring(15).replace(/[,()]/g, ''));
74
- if (date) {
75
- this.cache_expiration = date.toISOString();
76
- }
77
- }
78
- }
79
-
80
- // If we have item_expiration, also set cache_expiration to the same value
81
- if (this.item_expiration) {
82
- this.cache_expiration = this.item_expiration;
83
- }
84
-
85
- if (this.actions === "") {
86
- this.actions = [];
87
- }
88
-
89
- // One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
90
- // property results in greatly increased memory usage. Because that makes sense.
91
- if (this.currency) {
92
- delete this.currency;
93
- }
94
- }
95
-
96
- CEconItem.prototype.getImageURL = function() {
97
- return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url + "/";
98
- };
99
-
100
- CEconItem.prototype.getLargeImageURL = function() {
101
- if(!this.icon_url_large) {
102
- return this.getImageURL();
103
- }
104
-
105
- return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url_large + "/";
106
- };
107
-
108
- CEconItem.prototype.getTag = function(category) {
109
- if (!this.tags) {
110
- return null;
111
- }
112
-
113
- for (var i = 0; i < this.tags.length; i++) {
114
- if (this.tags[i].category == category) {
115
- return this.tags[i];
116
- }
117
- }
118
-
119
- return null;
120
- };
1
+ module.exports = CEconItem;
2
+
3
+ function CEconItem(item, description, contextID) {
4
+ var thing;
5
+ for (thing in item) {
6
+ if (item.hasOwnProperty(thing)) {
7
+ this[thing] = item[thing];
8
+ }
9
+ }
10
+
11
+ var isCurrency = !!(this.is_currency || this.currency) || typeof this.currencyid !== 'undefined'; // I don't want to put this on the object yet; it's nice to have the ids at the top of printed output
12
+
13
+ if (isCurrency) {
14
+ this.currencyid = this.id = (this.id || this.currencyid);
15
+ } else {
16
+ this.assetid = this.id = (this.id || this.assetid);
17
+ }
18
+
19
+ this.instanceid = this.instanceid || '0';
20
+ this.amount = parseInt(this.amount, 10);
21
+ this.contextid = this.contextid || contextID.toString();
22
+
23
+ // Merge the description
24
+ if (description) {
25
+ // Is this a listing of descriptions?
26
+ if (description[this.classid + '_' + this.instanceid]) {
27
+ description = description[this.classid + '_' + this.instanceid];
28
+ }
29
+
30
+ for (thing in description) {
31
+ if (description.hasOwnProperty(thing)) {
32
+ this[thing] = description[thing];
33
+ }
34
+ }
35
+ }
36
+
37
+ this.is_currency = isCurrency;
38
+ this.tradable = !!this.tradable;
39
+ this.marketable = !!this.marketable;
40
+ this.commodity = !!this.commodity;
41
+ this.market_tradable_restriction = (this.market_tradable_restriction ? parseInt(this.market_tradable_restriction, 10) : 0);
42
+ this.market_marketable_restriction = (this.market_marketable_restriction ? parseInt(this.market_marketable_restriction, 10) : 0);
43
+ this.fraudwarnings = this.fraudwarnings || [];
44
+ this.descriptions = this.descriptions || [];
45
+
46
+ if (this.owner && JSON.stringify(this.owner) == '{}') {
47
+ this.owner = null;
48
+ }
49
+
50
+ // Restore old property names of tags
51
+ if (this.tags) {
52
+ this.tags = this.tags.map(function(tag) {
53
+ return {
54
+ "internal_name": tag.internal_name,
55
+ "name": tag.localized_tag_name || tag.name,
56
+ "category": tag.category,
57
+ "color": tag.color || "",
58
+ "category_name": tag.localized_category_name || tag.category_name
59
+ };
60
+ });
61
+ }
62
+
63
+ // Restore market_fee_app, if applicable
64
+ var match;
65
+ if (this.appid == 753 && this.contextid == 6 && this.market_hash_name && (match = this.market_hash_name.match(/^(\d+)\-/))) {
66
+ this.market_fee_app = parseInt(match[1], 10);
67
+ }
68
+
69
+ // Restore cache_expiration, if we can (for CS:GO items)
70
+ if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
71
+ let description = this.owner_descriptions.find(d => d.value && d.value.indexOf('Tradable After ') == 0);
72
+ if (description) {
73
+ let date = new Date(description.value.substring(15).replace(/[,()]/g, ''));
74
+ if (date) {
75
+ this.cache_expiration = date.toISOString();
76
+ }
77
+ }
78
+ }
79
+
80
+ // If we have item_expiration, also set cache_expiration to the same value
81
+ if (this.item_expiration) {
82
+ this.cache_expiration = this.item_expiration;
83
+ }
84
+
85
+ if (this.actions === "") {
86
+ this.actions = [];
87
+ }
88
+
89
+ // One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
90
+ // property results in greatly increased memory usage. Because that makes sense.
91
+ if (this.currency) {
92
+ delete this.currency;
93
+ }
94
+ }
95
+
96
+ CEconItem.prototype.getImageURL = function() {
97
+ return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url + "/";
98
+ };
99
+
100
+ CEconItem.prototype.getLargeImageURL = function() {
101
+ if(!this.icon_url_large) {
102
+ return this.getImageURL();
103
+ }
104
+
105
+ return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url_large + "/";
106
+ };
107
+
108
+ CEconItem.prototype.getTag = function(category) {
109
+ if (!this.tags) {
110
+ return null;
111
+ }
112
+
113
+ for (var i = 0; i < this.tags.length; i++) {
114
+ if (this.tags[i].category == category) {
115
+ return this.tags[i];
116
+ }
117
+ }
118
+
119
+ return null;
120
+ };