From b66b65db65afdbf179646cef3b03ff9a6062b9ba Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 25 Nov 2017 16:10:13 +0200 Subject: [PATCH] Add unsetManagement and add help for management (un/)set commands --- src/commands.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/commands.js b/src/commands.js index 8191ddc7..62aa92b7 100644 --- a/src/commands.js +++ b/src/commands.js @@ -60,16 +60,24 @@ commands.help = (sender, args, reply, app, evt) => { **login** <_phone_> - Request an authentication code.
**logout** - Log out from Telegram. Currently broken. +**setManagement** - Mark the room as a management room. +**unsetManagement** - Undo management room marking. + **api** <_method_> <_args_> - Call a Telegram API method. Args is always a JSON object. Disabled by default. ` reply(replyMsg, { allowHTML: true }) } -commands.setManagement = async (sender, _, reply, app, evt) => { +commands.setManagement = (sender, _, reply, app, evt) => { app.managementRooms.push(evt.room_id) reply("Room marked as management room. You can now run commands without the `$cmdprefix` prefix.") } +commands.unsetManagement = (sender, _, reply, app, evt) => { + app.managementRooms.splice(app.managementRooms.indexOf(evt.room_id), 1) + reply("Room unmarked as management room. You must now include the `$cmdprefix` prefix when running commands.") +} + ///////////////////////////// // Authentication handlers //