mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-02-28 21:30:59 +08:00
Added getTradeURL method
This commit is contained in:
parent
7da7ecfc56
commit
a03dad9507
12
index.js
12
index.js
@ -370,6 +370,18 @@ SteamCommunity.prototype.loggedIn = function(callback) {
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.getTradeURL = function(callback) {
|
||||
this._myProfile("/tradeoffers/privacy", null, (err, response, body) => {
|
||||
var match = body.match(/https?:\/\/(www.)?steamcommunity.com\/tradeoffer\/new\/?\?partner=\d+(&|&)token=([a-zA-Z0-9-_]+)/);
|
||||
if (match) {
|
||||
var token = match[3];
|
||||
callback(null, match[0], token);
|
||||
} else {
|
||||
callback(new Error("Malformed response"));
|
||||
}
|
||||
}, "tradeoffermanager");
|
||||
};
|
||||
|
||||
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
|
||||
var self = this;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user