steamutils 1.2.16 → 1.2.18
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +34 -2
- package/package.json +1 -1
package/index.js
CHANGED
@@ -5771,6 +5771,36 @@ class SteamUser {
|
|
5771
5771
|
}
|
5772
5772
|
}
|
5773
5773
|
|
5774
|
+
async acceptTradeOffer(tradeOfferID, partnerSteamId) {
|
5775
|
+
if (!partnerSteamId) {
|
5776
|
+
try {
|
5777
|
+
partnerSteamId = (await this._httpRequest({
|
5778
|
+
url: `tradeoffer/${tradeOfferID}`,
|
5779
|
+
}))?.data?.split(`var g_ulTradePartnerSteamID = '`)?.[1]?.split(`';`)[0]
|
5780
|
+
} catch (e) {
|
5781
|
+
}
|
5782
|
+
}
|
5783
|
+
if (!partnerSteamId) {
|
5784
|
+
console.error("Missing partner ID")
|
5785
|
+
return
|
5786
|
+
}
|
5787
|
+
|
5788
|
+
const result = await this._httpRequest({
|
5789
|
+
url: `tradeoffer/${tradeOfferID}/accept`,
|
5790
|
+
method: 'POST',
|
5791
|
+
data: `sessionid=${this._sessionid}&serverid=1&tradeofferid=${tradeOfferID}&partner=${partnerSteamId}&captcha=`,
|
5792
|
+
headers: {
|
5793
|
+
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
|
5794
|
+
Referer: `https://steamcommunity.com/tradeoffer/${tradeOfferID}/`
|
5795
|
+
}
|
5796
|
+
})
|
5797
|
+
|
5798
|
+
return result?.data
|
5799
|
+
const successExample = {
|
5800
|
+
"tradeid": "4726012948246770347"
|
5801
|
+
}
|
5802
|
+
}
|
5803
|
+
|
5774
5804
|
async getTradeOffer() {
|
5775
5805
|
const result = await this._httpRequest({
|
5776
5806
|
url: `${this._myProfile}/tradeoffers/`,
|
@@ -5914,8 +5944,10 @@ class SteamUser {
|
|
5914
5944
|
const response = await this._httpRequestAjax({
|
5915
5945
|
url: `https://store.steampowered.com/twofactor/manage_action`,
|
5916
5946
|
method: 'POST',
|
5917
|
-
data:
|
5918
|
-
|
5947
|
+
data: "action=deauthorize&sessionid=" + this._sessionid,
|
5948
|
+
headers: {
|
5949
|
+
"content-type": "application/x-www-form-urlencoded",
|
5950
|
+
"Referer": "https://store.steampowered.com/twofactor/manage",
|
5919
5951
|
}
|
5920
5952
|
})
|
5921
5953
|
console.log(response.data);
|