mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2026-08-22 14:43:29 +08:00
Added clearPersonaNameHistory
This commit is contained in:
33
index.js
33
index.js
@@ -5,6 +5,8 @@ const Request = require('request');
|
|||||||
const RSA = require('node-bignumber').Key;
|
const RSA = require('node-bignumber').Key;
|
||||||
const SteamID = require('steamid');
|
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";
|
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);
|
require('util').inherits(SteamCommunity, require('events').EventEmitter);
|
||||||
@@ -431,7 +433,7 @@ SteamCommunity.prototype.loggedIn = function(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype.getTradeURL = 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) {
|
if (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
return;
|
return;
|
||||||
@@ -448,7 +450,7 @@ SteamCommunity.prototype.getTradeURL = function(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype.changeTradeURL = 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) {
|
if (!callback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -463,6 +465,33 @@ SteamCommunity.prototype.changeTradeURL = function(callback) {
|
|||||||
}, "steamcommunity");
|
}, "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) {
|
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user