From e22133d685fe99b066aecf2c339bdf14b098b925 Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 18 Jul 2017 02:52:59 +0000 Subject: [PATCH] fix ignore --- modules/ignore/ignore.js | 56 +++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/modules/ignore/ignore.js b/modules/ignore/ignore.js index 37a1071..52bf6a2 100644 --- a/modules/ignore/ignore.js +++ b/modules/ignore/ignore.js @@ -116,35 +116,31 @@ var ignore = function(dbot) { if(module == '*' || _.include(dbot.config.moduleNames, item) || _.include(dbot.commands, item)) { dbot.api.users.resolveUser(event.server, nick, function(err, user) { this.api.getUserIgnores(user, function(err, ignores) { - if(!err) { - if(!ignores) { - ignores = { - 'id': user.id, - 'ignores': [], - 'bans': [] - }; - } + if(!ignores) { + ignores = { + 'id': user.id, + 'ignores': [], + 'bans': [] + }; + } - if(!_.include(ignores.bans, item)) { - ignores.bans.push(item); - this.db.save('ignores', user.id, ignores, function(err) { - if(!err) { - event.reply(dbot.t('banned_success', { - 'user': event.user, - 'banned': nick, - 'module': item - })); - } - }); - } else { - event.reply(dbot.t('already_banned', { - 'user': event.user, - 'banned': nick - })); - } - } else { - event.reply(err); - } + if(!_.include(ignores.bans, item)) { + ignores.bans.push(item); + this.db.save('ignores', user.id, ignores, function(err) { + if(!err) { + event.reply(dbot.t('banned_success', { + 'user': event.user, + 'banned': nick, + 'module': item + })); + } + }); + } else { + event.reply(dbot.t('already_banned', { + 'user': event.user, + 'banned': nick + })); + } }.bind(this)); }.bind(this)); } else { @@ -264,8 +260,8 @@ var ignore = function(dbot) { commands['~ignorechannel'].regex = [/^ignorechannel ([^ ]+) ([^ ]+)$/, 3]; commands['~unignorechannel'].regex = [/^unignorechannel ([^ ]+) ([^ ]+)$/, 3]; - commands['~ban'].access = 'moderator'; - commands['~unban'].access = 'moderator'; + commands['~ban'].access = 'power_user'; + commands['~unban'].access = 'power_user'; commands['~ignorechannel'].access = 'moderator'; commands['~unignorechannel'].access = 'moderator';