mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-02-28 21:30:59 +08:00
Merge pull request #186 from hell00world/master
Added changeTradeURL method
This commit is contained in:
commit
0b8dd57a40
14
index.js
14
index.js
@ -413,6 +413,18 @@ SteamCommunity.prototype.getTradeURL = function(callback) {
|
||||
}, "tradeoffermanager");
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.changeTradeURL = function (callback) {
|
||||
this._myProfile("/tradeoffers/newtradeurl", {
|
||||
"sessionid": this.getSessionID()
|
||||
}, (err, response, body) => {
|
||||
if (err || response.statusCode != 200)
|
||||
return callback(err || "HTTP error " + response.statusCode);
|
||||
if (!body || typeof body !== "string" || body.length < 3 || body.indexOf('"') !== 0)
|
||||
return callback(new Error("Malformed response"));
|
||||
return callback(null, body.replace(/\"/g, '')); //"t1o2k3e4n" => t1o2k3e4n
|
||||
}, "tradeoffermanager");
|
||||
};
|
||||
|
||||
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
|
||||
var self = this;
|
||||
|
||||
@ -473,4 +485,4 @@ require('./classes/CSteamUser.js');
|
||||
/**
|
||||
@callback SteamCommunity~genericErrorCallback
|
||||
@param {Error|null} err - An Error object on failure, or null on success
|
||||
*/
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user