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:
@@ -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 <reason></code> - Warns the user.
|
||||
|
15
handlers/commands/leave.js
Normal file
15
handlers/commands/leave.js
Normal 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;
|
Reference in New Issue
Block a user