From 17e5b9478224d526d97d58c7202562bc6aec8144 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 21 Jun 2016 20:39:23 -0600 Subject: [PATCH] Added deleting events in CSteamGroup (#109) * Added deleteEvent() * Added deleteGroupEvent() --- classes/CSteamGroup.js | 4 ++++ components/groups.js | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/classes/CSteamGroup.js b/classes/CSteamGroup.js index 2e6f8ef..ef130fc 100644 --- a/classes/CSteamGroup.js +++ b/classes/CSteamGroup.js @@ -98,6 +98,10 @@ CSteamGroup.prototype.editEvent = function(id, name, type, description, time, se this._community.editGroupEvent(this.steamID, id, name, type, description, time, server, callback); }; +CSteamGroup.prototype.deleteEvent = function (id, callback) { + this._community.deleteGroupEvent(this.steamID, id, callback); +}; + CSteamGroup.prototype.setPlayerOfTheWeek = function(steamID, callback) { this._community.setGroupPlayerOfTheWeek(this.steamID, steamID, callback); }; diff --git a/components/groups.js b/components/groups.js index c9a5f18..64da890 100644 --- a/components/groups.js +++ b/components/groups.js @@ -344,6 +344,30 @@ SteamCommunity.prototype.editGroupEvent = function (gid, id, name, type, descrip }, "steamcommunity"); }; +SteamCommunity.prototype.deleteGroupEvent = function(gid, id, callback) { + if (typeof gid === 'string') { + gid = new SteamID(gid); + } + + var form = { + "sessionid": this.getSessionID(), + "action": "deleteEvent", + "eventID": id + }; + + var self = this; + this.httpRequestPost({ + "uri": "https://steamcommunity.com/gid/" + gid.toString() + "/eventEdit", + "form": form + }, function(err, response, body) { + if(!callback) { + return; + } + + callback(err || null); + }, "steamcommunity"); +}; + SteamCommunity.prototype.setGroupPlayerOfTheWeek = function(gid, steamID, callback) { if(typeof gid === 'string') { gid = new SteamID(gid);