mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-14 15:00:07 +08:00
Added clearPersonaNameHistory
This commit is contained in:
parent
224b7b85e0
commit
a46ed17415
33
index.js
33
index.js
@ -5,6 +5,8 @@ const Request = require('request');
|
||||
const RSA = require('node-bignumber').Key;
|
||||
const SteamID = require('steamid');
|
||||
|
||||
const Helpers = require('./components/helpers.js');
|
||||
|
||||
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36";
|
||||
|
||||
require('util').inherits(SteamCommunity, require('events').EventEmitter);
|
||||
@ -431,7 +433,7 @@ SteamCommunity.prototype.loggedIn = function(callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.getTradeURL = function(callback) {
|
||||
this._myProfile("/tradeoffers/privacy", null, (err, response, body) => {
|
||||
this._myProfile("tradeoffers/privacy", null, (err, response, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
@ -448,7 +450,7 @@ SteamCommunity.prototype.getTradeURL = function(callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.changeTradeURL = function(callback) {
|
||||
this._myProfile("/tradeoffers/newtradeurl", {"sessionid": this.getSessionID()}, (err, response, body) => {
|
||||
this._myProfile("tradeoffers/newtradeurl", {"sessionid": this.getSessionID()}, (err, response, body) => {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
@ -463,6 +465,33 @@ SteamCommunity.prototype.changeTradeURL = function(callback) {
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear your profile name (alias) history.
|
||||
* @param {function} callback
|
||||
*/
|
||||
SteamCommunity.prototype.clearPersonaNameHistory = function(callback) {
|
||||
this._myProfile("ajaxclearaliashistory/", {"sessionid": this.getSessionID()}, (err, res, body) => {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (res.statusCode != 200) {
|
||||
return callback(new Error("HTTP error " + res.statusCode));
|
||||
}
|
||||
|
||||
try {
|
||||
body = JSON.parse(body);
|
||||
callback(Helpers.eresultError(body.success));
|
||||
} catch (ex) {
|
||||
return callback(new Error("Malformed response"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
|
||||
var self = this;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user