2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-09-05 08:35:22 +00:00

Added /leave

This commit is contained in:
GingerPlusPlus
2017-09-28 22:59:35 +02:00
parent 36f4180ebe
commit fdfbfa5727
5 changed files with 24 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ const commandReference = `\
<b>Master commands</b>:
<code>/admin</code> - Makes the user admin.
<code>/unadmin</code> - Demotes the user from admin list.
<code>/leave</code> - Makes the bot leave the group cleanly.
<b>Admin commands</b>:
<code>/warn &lt;reason&gt;</code> - Warns the user.

View File

@@ -0,0 +1,15 @@
'use strict';
const { masterID } = require('../../config.json');
const { removeGroup } = require('../../stores/group');
const leaveCommandHandler = async ctx => {
if (ctx.from.id !== masterID) {
return null;
}
await removeGroup(ctx.chat);
return ctx.telegram.leaveChat(ctx.chat.id);
};
module.exports = leaveCommandHandler;