steamcommunity 3.49.0 → 3.50.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.
- package/README.md +21 -21
- package/classes/CEconItem.js +136 -120
- package/classes/CSteamUser.js +225 -225
- package/components/groups.js +798 -798
- package/components/http.js +162 -162
- package/components/login.js +110 -110
- package/components/users.js +847 -838
- package/components/webapi.js +221 -221
- package/index.js +466 -466
- package/package.json +44 -44
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# Steam Community for Node.js
|
|
2
|
-
[](https://npmjs.com/package/steamcommunity)
|
|
3
|
-
[](https://npmjs.com/package/steamcommunity)
|
|
4
|
-
[](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
|
|
5
|
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity¤cy_code=USD)
|
|
6
|
-
|
|
7
|
-
This module provides an easy interface for the Steam Community website. This module can be used to simply login to
|
|
8
|
-
steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
|
|
9
|
-
|
|
10
|
-
**Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
|
|
11
|
-
requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
|
12
|
-
Such issues may be ignored!**
|
|
13
|
-
|
|
14
|
-
# Documentation
|
|
15
|
-
|
|
16
|
-
Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
|
|
17
|
-
|
|
18
|
-
# Support
|
|
19
|
-
|
|
20
|
-
Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
|
|
21
|
-
on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
|
1
|
+
# Steam Community for Node.js
|
|
2
|
+
[](https://npmjs.com/package/steamcommunity)
|
|
3
|
+
[](https://npmjs.com/package/steamcommunity)
|
|
4
|
+
[](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
|
|
5
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity¤cy_code=USD)
|
|
6
|
+
|
|
7
|
+
This module provides an easy interface for the Steam Community website. This module can be used to simply login to
|
|
8
|
+
steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
|
|
9
|
+
|
|
10
|
+
**Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
|
|
11
|
+
requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
|
12
|
+
Such issues may be ignored!**
|
|
13
|
+
|
|
14
|
+
# Documentation
|
|
15
|
+
|
|
16
|
+
Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
|
|
17
|
+
|
|
18
|
+
# Support
|
|
19
|
+
|
|
20
|
+
Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
|
|
21
|
+
on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
package/classes/CEconItem.js
CHANGED
|
@@ -1,120 +1,136 @@
|
|
|
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) && !this.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(
|
|
72
|
-
if (description) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if(
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
module.exports = CEconItem;
|
|
2
|
+
|
|
3
|
+
function CEconItem(item, description, contextID, assetProperties) {
|
|
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) && !this.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/Marketable After ") == 0);
|
|
72
|
+
if (description) {
|
|
73
|
+
const match = description.value.match(/(\d{1,2}) (\w+) @ (\d{1,2}:\d{2})(am|pm)/i);
|
|
74
|
+
const [, day, month, time, meridian] = match;
|
|
75
|
+
const now = new Date();
|
|
76
|
+
let year = now.getFullYear();
|
|
77
|
+
let date = new Date(`${day} ${month} ${year} ${time} ${meridian}`);
|
|
78
|
+
|
|
79
|
+
if (date.getTime() < now.getTime()) {
|
|
80
|
+
date = new Date(
|
|
81
|
+
`${day} ${month} ${year + 1} ${time} ${meridian}`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (date) {
|
|
86
|
+
this.cache_expiration = date.toISOString();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// If we have item_expiration, also set cache_expiration to the same value
|
|
92
|
+
if (this.item_expiration) {
|
|
93
|
+
this.cache_expiration = this.item_expiration;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (this.actions === "") {
|
|
97
|
+
this.actions = [];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Assign asset_properties if provided
|
|
101
|
+
if (assetProperties) {
|
|
102
|
+
this.asset_properties = assetProperties;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
|
|
106
|
+
// property results in greatly increased memory usage. Because that makes sense.
|
|
107
|
+
if (this.currency) {
|
|
108
|
+
delete this.currency;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
CEconItem.prototype.getImageURL = function() {
|
|
113
|
+
return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url + "/";
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
CEconItem.prototype.getLargeImageURL = function() {
|
|
117
|
+
if(!this.icon_url_large) {
|
|
118
|
+
return this.getImageURL();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url_large + "/";
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
CEconItem.prototype.getTag = function(category) {
|
|
125
|
+
if (!this.tags) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
for (var i = 0; i < this.tags.length; i++) {
|
|
130
|
+
if (this.tags[i].category == category) {
|
|
131
|
+
return this.tags[i];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return null;
|
|
136
|
+
};
|