2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-09-05 08:35:22 +00:00
Files
the-guard-bot/handlers/addedToGroup.js
2017-09-22 19:47:38 +02:00

19 lines
457 B
JavaScript

'use strict';
const { addGroup } = require('../stores/groups');
const { masterID } = require('../config.json');
const addedToGroupHandler = (ctx, next) => {
const msg = ctx.message;
const wasAdded = msg.new_chat_members.some(user => user.username === ctx.me);
if (wasAdded && ctx.from.id === masterID) {
addGroup(ctx.chat);
ctx.reply('Ok, I\'ll help you manage this group from now.');
}
return next();
};
module.exports = addedToGroupHandler;