mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-02-18 15:00:17 +08:00
Added CSteamGroup.setPlayerOfTheWeek method
This commit is contained in:
parent
b0b8dbbabf
commit
d257108500
@ -174,3 +174,37 @@ CSteamGroup.prototype.scheduleEvent = function(name, type, description, time, se
|
|||||||
callback(null);
|
callback(null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CSteamGroup.prototype.setPlayerOfTheWeek = function(steamID, callback) {
|
||||||
|
var form = {
|
||||||
|
"xml": 1,
|
||||||
|
"action": "potw",
|
||||||
|
"memberId": steamID.getSteam3RenderedID(),
|
||||||
|
"sessionid": this._community.getSessionID()
|
||||||
|
};
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/potwEdit", {"form": form}, function(err, response, body) {
|
||||||
|
if(!callback) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(err || response.statusCode != 200) {
|
||||||
|
callback(err || "HTTP error " + response.statusCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xml2js.parseString(body, function(err, results) {
|
||||||
|
if(err) {
|
||||||
|
callback(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(results.response.results[0] == 'OK') {
|
||||||
|
callback(null, new SteamID(results.response.oldPOTW[0]), new SteamID(results.response.newPOTW[0]));
|
||||||
|
} else {
|
||||||
|
callback(results.response.results[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user