steamutils 1.1.64 → 1.1.66

Sign up to get free protection for your applications and to get access to all the features.
package/SteamClient.js CHANGED
@@ -103,6 +103,7 @@ function SteamClient({
103
103
  playersProfile: [],
104
104
  partyInvite: [],
105
105
  friendRelationship: [],
106
+ tradeOffers: [],
106
107
  }
107
108
 
108
109
  const gcCallback = {}
@@ -901,6 +902,10 @@ function SteamClient({
901
902
  }
902
903
  }
903
904
  });
905
+
906
+ steamClient.on('tradeOffers', async function (count) {
907
+ callEvent(events.tradeOffers, count)
908
+ });
904
909
  }
905
910
 
906
911
  function sendFriendTyping(steamId, callback) {
package/index.js CHANGED
@@ -5456,9 +5456,7 @@ class SteamUser {
5456
5456
  // currency: [],
5457
5457
  // ready: false
5458
5458
  // }
5459
- const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5460
- ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5461
- }), {})
5459
+ const tradeURLParams = SteamUser.parseTradeURL(tradeURL)
5462
5460
  const result = await this._httpRequest({
5463
5461
  url: `tradeoffer/new/send`,
5464
5462
  headers: {
@@ -5468,7 +5466,7 @@ class SteamUser {
5468
5466
  },
5469
5467
  data: {
5470
5468
  serverid: 1,
5471
- partner: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5469
+ partner: tradeURLParams.steamId,
5472
5470
  tradeoffermessage,
5473
5471
  json_tradeoffer: JSON.stringify({
5474
5472
  newversion: true,
@@ -5497,6 +5495,18 @@ class SteamUser {
5497
5495
  email_domain: "gmail.com"
5498
5496
  }
5499
5497
  }
5498
+
5499
+ static parseTradeURL(tradeURL){
5500
+ const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5501
+ ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5502
+ }), {})
5503
+
5504
+ return {
5505
+ accountId: tradeURLParams.partner,
5506
+ steamId: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5507
+ token: tradeURLParams.token,
5508
+ }
5509
+ }
5500
5510
  }
5501
5511
 
5502
5512
  export default SteamUser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.1.64",
3
+ "version": "1.1.66",
4
4
  "main":"index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.3.4",