From a3468bf99bb1470653999c59298c8252b33535a4 Mon Sep 17 00:00:00 2001 From: Revadike Date: Mon, 14 Oct 2019 04:28:53 +0200 Subject: [PATCH] Optional hidden parameter to postGroupAnnouncement --- components/groups.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/components/groups.js b/components/groups.js index d4906de..9f74f50 100644 --- a/components/groups.js +++ b/components/groups.js @@ -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;