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