steamutils 1.2.31 → 1.2.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/SteamClient.js +23 -4
  2. package/index.js +10 -7
  3. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -116,6 +116,7 @@ function SteamClient({
116
116
  tradeOffers: [],
117
117
  offlineMessages: [],
118
118
  friendsList: [],
119
+ gifts: [],
119
120
  }
120
121
 
121
122
  const gcCallback = {}
@@ -1134,9 +1135,18 @@ function SteamClient({
1134
1135
  });
1135
1136
 
1136
1137
  steamClient.on('gifts', async function (gid, packageid, TimeCreated, TimeExpiration, TimeSent, TimeAcked, TimeRedeemed, RecipientAddress, SenderAddress, SenderName) {
1137
- const community = new SteamCommunity();
1138
- community.setCookies(await getCookiesWait())
1139
- community.redeemGift(gid)
1138
+ callEvent(events.gifts, {
1139
+ gid,
1140
+ packageid,
1141
+ TimeCreated,
1142
+ TimeExpiration,
1143
+ TimeSent,
1144
+ TimeAcked,
1145
+ TimeRedeemed,
1146
+ RecipientAddress,
1147
+ SenderAddress,
1148
+ SenderName
1149
+ })
1140
1150
  });
1141
1151
  }
1142
1152
 
@@ -1619,7 +1629,16 @@ function SteamClient({
1619
1629
  })
1620
1630
  })
1621
1631
  },
1622
- onAnyEvent
1632
+ onAnyEvent,
1633
+ async redeemGift(gid){
1634
+ try {
1635
+ const community = new SteamCommunity();
1636
+ let cookies = await getCookiesWait();
1637
+ community.setCookies(typeof cookies === "string" ? cookies.split(';') : cookies)
1638
+ community.redeemGift(gid)
1639
+ } catch (e) {
1640
+ }
1641
+ }
1623
1642
  }
1624
1643
  }
1625
1644
 
package/index.js CHANGED
@@ -5885,14 +5885,17 @@ class SteamUser {
5885
5885
  }
5886
5886
 
5887
5887
  static parseTradeURL(tradeURL){
5888
- const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5889
- ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5890
- }), {})
5888
+ try {
5889
+ const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5890
+ ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5891
+ }), {})
5891
5892
 
5892
- return {
5893
- accountId: tradeURLParams.partner,
5894
- steamId: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5895
- token: tradeURLParams.token,
5893
+ return {
5894
+ accountId: tradeURLParams.partner,
5895
+ steamId: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5896
+ token: tradeURLParams.token,
5897
+ }
5898
+ } catch (e) {
5896
5899
  }
5897
5900
  }
5898
5901
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.4.0",