Merge pull request #233 from Revadike/patch-1

Optional hidden parameter to postGroupAnnouncement
This commit is contained in:
Alex Corn 2019-10-15 01:13:03 +02:00 committed by GitHub
commit 59bf4f1e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,22 +156,33 @@ SteamCommunity.prototype.getAllGroupAnnouncements = function(gid, time, callback
}, "steamcommunity"); }, "steamcommunity");
}; };
SteamCommunity.prototype.postGroupAnnouncement = function(gid, headline, content, callback) { SteamCommunity.prototype.postGroupAnnouncement = function(gid, headline, content, hidden, callback) {
if(typeof gid === 'string') { if(typeof gid === 'string') {
gid = new SteamID(gid); gid = new SteamID(gid);
} }
if(typeof hidden === 'function') {
callback = hidden;
hidden = false;
}
var self = this; var self = this;
this.httpRequestPost({ var form = {
"uri": "https://steamcommunity.com/gid/" + gid.getSteamID64() + "/announcements",
"form": {
"sessionID": this.getSessionID(), "sessionID": this.getSessionID(),
"action": "post", "action": "post",
"headline": headline, "headline": headline,
"body": content, "body": content,
"languages[0][headline]": headline, "languages[0][headline]": headline,
"languages[0][body]": content "languages[0][body]": content
};
if(hidden) {
form.is_hidden = "is_hidden"
} }
this.httpRequestPost({
"uri": "https://steamcommunity.com/gid/" + gid.getSteamID64() + "/announcements",
form
}, function(err, response, body) { }, function(err, response, body) {
if(!callback) { if(!callback) {
return; return;