steamutils 1.2.31 → 1.2.33
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/SteamClient.js +23 -4
- package/index.js +10 -7
- 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
|
-
|
1138
|
-
|
1139
|
-
|
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
|
-
|
5889
|
-
|
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
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
|
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
|
|