2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-10-15 14:25:51 +00:00

refactoring, created messages folder and added context state

This commit is contained in:
Pouria Ezzati
2017-10-06 16:34:23 +03:30
parent 231526de4d
commit 672fd562f3
18 changed files with 120 additions and 124 deletions

View File

@@ -1,13 +1,9 @@
'use strict';
// Utils
const { loadJSON } = require('../../utils/json');
const { link } = require('../../utils/tg');
const { logError } = require('../../utils/log');
// Config
const { masterID } = loadJSON('config.json');
// Bot
const { replyOptions } = require('../../bot/options');
@@ -20,8 +16,9 @@ const {
nowarns
} = require('../../stores/user');
const adminHandler = async ({ message, reply }) => {
if (message.from.id !== masterID) {
const adminHandler = async ({ message, reply, state }) => {
const { isMaster, user } = state;
if (!isMaster) {
return null;
}
@@ -29,7 +26,7 @@ const adminHandler = async ({ message, reply }) => {
? message.reply_to_message.from
: message.commandMention
? message.commandMention
: message.from;
: user;
if (await isBanned(userToAdmin)) {
return reply(' <b>Can\'t admin banned user.</b>', replyOptions);