diff --git a/index.js b/index.js index e95ced9..dab68fc 100644 --- a/index.js +++ b/index.js @@ -382,6 +382,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; @@ -442,4 +454,4 @@ require('./classes/CSteamUser.js'); /** @callback SteamCommunity~genericErrorCallback @param {Error|null} err - An Error object on failure, or null on success - */ \ No newline at end of file + */