2
0
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:
GingerPlusPlus
2017-09-22 19:47:38 +02:00
parent e0279e3a95
commit d5e3e1f0b5
3 changed files with 8 additions and 8 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);