mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 06:05:22 +00:00
Made sure names of handlers end with "handler"
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
const { addGroup } = require('../stores/groups');
|
||||
const { masterID } = require('../config.json');
|
||||
|
||||
const addedToGroup = (ctx, next) => {
|
||||
const addedToGroupHandler = (ctx, next) => {
|
||||
const msg = ctx.message;
|
||||
|
||||
const wasAdded = msg.new_chat_members.some(user => user.username === ctx.me);
|
||||
@@ -15,4 +15,4 @@ const addedToGroup = (ctx, next) => {
|
||||
return next();
|
||||
};
|
||||
|
||||
module.exports = addedToGroup;
|
||||
module.exports = addedToGroupHandler;
|
||||
|
@@ -29,7 +29,7 @@ const gifs = [
|
||||
|
||||
const randomChoice = arr => arr[Math.floor(Math.random() * arr.length)];
|
||||
|
||||
const leaveUnmanaged = async (ctx, next) => {
|
||||
const leaveUnmanagedHandler = async (ctx, next) => {
|
||||
if (ctx.chat.type === 'private' || await managesGroup(ctx.chat)) {
|
||||
return next();
|
||||
}
|
||||
@@ -38,4 +38,4 @@ const leaveUnmanaged = async (ctx, next) => {
|
||||
return ctx.telegram.leaveChat(ctx.chat.id);
|
||||
};
|
||||
|
||||
module.exports = leaveUnmanaged;
|
||||
module.exports = leaveUnmanagedHandler;
|
||||
|
8
index.js
8
index.js
@@ -23,11 +23,11 @@ const banHandler = require('./handlers/ban');
|
||||
const unbanHandler = require('./handlers/unban');
|
||||
const messageHandler = require('./handlers/message');
|
||||
const antibotHandler = require('./handlers/antibot');
|
||||
const addedToGroup = require('./handlers/addedToGroup');
|
||||
const leaveUnmanaged = require('./handlers/leaveUnmanaged');
|
||||
const addedToGroupHandler = require('./handlers/addedToGroup');
|
||||
const leaveUnmanagedHandler = require('./handlers/leaveUnmanaged');
|
||||
|
||||
bot.on('new_chat_members', addedToGroup);
|
||||
bot.use(leaveUnmanaged);
|
||||
bot.on('new_chat_members', addedToGroupHandler);
|
||||
bot.use(leaveUnmanagedHandler);
|
||||
bot.use(middlewareHandler);
|
||||
bot.command('admin', adminHandler);
|
||||
bot.command('unadmin', unAdminHandler);
|
||||
|
Reference in New Issue
Block a user