From 68d72098ef78aeefd584aebdc006501f5433277a Mon Sep 17 00:00:00 2001 From: Thomas Rory Gummerson Date: Mon, 24 Jul 2017 18:37:43 +0200 Subject: [PATCH] admin tools --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index bab275d..ad6085d 100644 --- a/index.js +++ b/index.js @@ -26,9 +26,13 @@ const config = loadJSON('config.json'); const bot = new Telegraf(config.token); -DEBUG && bot.command('adminme', ctx => - (admins.admin(ctx.from), - ctx.reply('Admined'))); +bot.command('admin', ({ message, reply }) => { + const userToAdmin = message.reply_to_message + ? message.reply_to_message.from + : message.from; + return admins.admin(userToAdmin).then(() => + reply('Admined ' + link(userToAdmin), replyOptions)); +}); bot.on('new_chat_member', deleteAfter(10 * 60 * 1000)); bot.on('left_chat_member', deleteAfter(10 * 60 * 1000));