mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-01-13 20:30:14 +08:00
Fixed some code style issues
This commit is contained in:
parent
0b8dd57a40
commit
5da6e40ebb
29
index.js
29
index.js
@ -13,7 +13,8 @@ module.exports = SteamCommunity;
|
|||||||
|
|
||||||
SteamCommunity.SteamID = SteamID;
|
SteamCommunity.SteamID = SteamID;
|
||||||
SteamCommunity.ConfirmationType = require('./resources/EConfirmationType.js');
|
SteamCommunity.ConfirmationType = require('./resources/EConfirmationType.js');
|
||||||
SteamCommunity.EResult = require('./resources/EResult.js');
|
SteamCommunity.EResult = require('./resources/EResult.js')
|
||||||
|
|
||||||
|
|
||||||
function SteamCommunity(options) {
|
function SteamCommunity(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@ -410,19 +411,23 @@ SteamCommunity.prototype.getTradeURL = function(callback) {
|
|||||||
} else {
|
} else {
|
||||||
callback(new Error("Malformed response"));
|
callback(new Error("Malformed response"));
|
||||||
}
|
}
|
||||||
}, "tradeoffermanager");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype.changeTradeURL = function (callback) {
|
SteamCommunity.prototype.changeTradeURL = function(callback) {
|
||||||
this._myProfile("/tradeoffers/newtradeurl", {
|
this._myProfile("/tradeoffers/newtradeurl", {"sessionid": this.getSessionID()}, (err, response, body) => {
|
||||||
"sessionid": this.getSessionID()
|
if (!callback) {
|
||||||
}, (err, response, body) => {
|
return;
|
||||||
if (err || response.statusCode != 200)
|
}
|
||||||
return callback(err || "HTTP error " + response.statusCode);
|
|
||||||
if (!body || typeof body !== "string" || body.length < 3 || body.indexOf('"') !== 0)
|
if (!body || typeof body !== "string" || body.length < 3 || body.indexOf('"') !== 0) {
|
||||||
return callback(new Error("Malformed response"));
|
callback(new Error("Malformed response"));
|
||||||
return callback(null, body.replace(/\"/g, '')); //"t1o2k3e4n" => t1o2k3e4n
|
return;
|
||||||
}, "tradeoffermanager");
|
}
|
||||||
|
|
||||||
|
var newToken = body.replace(/"/g, ''); //"t1o2k3e4n" => t1o2k3e4n
|
||||||
|
callback(null, "https://steamcommunity.com/tradeoffer/new/?partner=" + this.steamID.accountid + "&token=" + newToken, newToken);
|
||||||
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
|
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
|
||||||
|
Loading…
Reference in New Issue
Block a user