From 0f16f1166875e7e280db9b291a0f9014db70b30c Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Wed, 17 Dec 2014 01:59:21 -0500 Subject: [PATCH] Added postAnnouncement method to CSteamGroup --- classes/CSteamGroup.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/classes/CSteamGroup.js b/classes/CSteamGroup.js index 677dd90..cf02563 100644 --- a/classes/CSteamGroup.js +++ b/classes/CSteamGroup.js @@ -91,3 +91,25 @@ CSteamGroup.prototype.getMembers = function(callback, members, link) { }); }); }; + +CSteamGroup.prototype.postAnnouncement = function(headline, content, callback) { + var form = { + "sessionID": this._community.getSessionID(), + "action": "post", + "headline": headline, + "body": content + }; + + this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/announcements", {"form": form}, function(err, response, body) { + if(!callback) { + return; + } + + if(err || response.statusCode >= 400) { + callback(err || "HTTP error " + response.statusCode); + return; + } + + // TODO: Handle Community errors + }); +};