steamutils 1.2.44 → 1.2.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +40 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5175,6 +5175,7 @@ class SteamUser {
5175
5175
  let result = {}
5176
5176
  const assets = []
5177
5177
  const descriptions = []
5178
+ const steamId = this.getSteamidUser()
5178
5179
 
5179
5180
  do {
5180
5181
  for (let i = 0; i < 10; i++) {
@@ -5199,7 +5200,7 @@ class SteamUser {
5199
5200
  if (Array.isArray(result?.assets)) {
5200
5201
  result.assets.forEach(function (asset) {
5201
5202
  const description = descriptions.find(description => description.classid === asset.classid)
5202
- assets.push({...description, ...asset})
5203
+ assets.push({...description, ...asset, steamId})
5203
5204
  })
5204
5205
  }
5205
5206
  } while (result.more_items)
@@ -5248,6 +5249,7 @@ class SteamUser {
5248
5249
  }
5249
5250
 
5250
5251
  async getInventoryTrading (appID, contextid = 2) {
5252
+ const steamId = this.getSteamidUser()
5251
5253
  for (let i = 0; i < 10; i++) {
5252
5254
  const url = `${this.getMyProfileURL()}/inventory/json/${appID}/${contextid}?l=english&trading=1`;
5253
5255
  const _result = (await this._httpRequestAjax(url))?.data
@@ -5258,14 +5260,22 @@ class SteamUser {
5258
5260
  console.error(_result)
5259
5261
  await sleep(5000)
5260
5262
  } else {
5261
- Object.values(_result.rgDescriptions).forEach(r => r.contextid = contextid)
5263
+ _result.rgDescriptions && Object.values(_result.rgDescriptions).forEach(r => {
5264
+ r.contextid = contextid;
5265
+ r.steamId = steamId
5266
+ })
5267
+ _result.rgInventory && Object.values(_result.rgInventory).forEach(r => {
5268
+ r.contextid = contextid;
5269
+ r.steamId = steamId
5270
+ })
5262
5271
  return _result
5263
5272
  break
5264
5273
  }
5265
5274
  }
5266
5275
 
5267
5276
  const exampleResult = {
5268
- success: true, rgInventory: {
5277
+ success: true,
5278
+ rgInventory: {
5269
5279
  30494845811: {
5270
5280
  id: "30494845811",
5271
5281
  classid: "1989278680",
@@ -5314,7 +5324,9 @@ class SteamUser {
5314
5324
  category_name: "Type"
5315
5325
  },]
5316
5326
  },
5317
- }, more: false, more_start: false
5327
+ },
5328
+ more: false,
5329
+ more_start: false
5318
5330
  }
5319
5331
  }
5320
5332
 
@@ -5334,7 +5346,14 @@ class SteamUser {
5334
5346
  console.error(_result)
5335
5347
  await sleep(5000)
5336
5348
  } else {
5337
- Object.values(_result.rgDescriptions).forEach(r => r.contextid = contextid)
5349
+ _result.rgDescriptions && Object.values(_result.rgDescriptions).forEach(r => {
5350
+ r.contextid = contextid;
5351
+ r.steamId = partner
5352
+ })
5353
+ _result.rgInventory && Object.values(_result.rgInventory).forEach(r => {
5354
+ r.contextid = contextid;
5355
+ r.steamId = partner
5356
+ })
5338
5357
  return _result
5339
5358
  break
5340
5359
  }
@@ -5937,6 +5956,22 @@ class SteamUser {
5937
5956
  }
5938
5957
  }
5939
5958
 
5959
+ async selectPreviousAvatar(avatarHash) {
5960
+ const result = await this._httpRequest({
5961
+ url: 'actions/selectPreviousAvatar',
5962
+ method: "POST",
5963
+ data: {
5964
+ json: 1,
5965
+ sha: avatarHash
5966
+ },
5967
+ headers: {
5968
+ 'Accept': 'application/json, text/plain, */*',
5969
+ }
5970
+ })
5971
+ return result?.data
5972
+ const successResponse = {"success": 1}
5973
+ }
5974
+
5940
5975
  async getMiniprofile(steamId = this._steamid_user){
5941
5976
  const response = await this._httpRequestAjax({
5942
5977
  url: `miniprofile/${SteamUser.steamID642Miniprofile(steamId)}/json/?origin=https://steamcommunity.com/`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.44",
3
+ "version": "1.2.46",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.4.0",