forked from GitHub/dbot
Add check for channel ignorance in command execution logic [#190]
This commit is contained in:
parent
27e24a8173
commit
eb62212626
@ -11,11 +11,12 @@ Command flow:
|
||||
command name
|
||||
2. Is the user banned from running the given command?
|
||||
3. Is the user ignoring the command?
|
||||
3. Does the use have the access level to run the command?
|
||||
4. Is the command set as disabled?
|
||||
4. Apply regex to the command, pass into event object.
|
||||
4. Is the channel ignoring the command?
|
||||
5. Does the use have the access level to run the command?
|
||||
6. Is the command set as disabled?
|
||||
7. Apply regex to the command, pass into event object.
|
||||
* If regex does not apply, show usage info.
|
||||
5. Run the command.
|
||||
8. Run the command.
|
||||
|
||||
This is the only module which is force loaded, even if it's not specified in
|
||||
the configuration file.
|
||||
|
@ -34,15 +34,12 @@ var api = function(dbot) {
|
||||
},
|
||||
|
||||
/**
|
||||
* Is user ignoring command?
|
||||
* Is item (user or channel) ignoring command?
|
||||
*/
|
||||
'isIgnoring': function(user, command) {
|
||||
'isIgnoring': function(item, command) {
|
||||
var module = dbot.commands[command].module;
|
||||
var ignoring = false;
|
||||
if(_.has(dbot.db.ignores, user) && _.include(dbot.db.ignores[user], module)) {
|
||||
ignoring = true;
|
||||
}
|
||||
return ignoring;
|
||||
return (_.has(dbot.db.ignores, item) &&
|
||||
_.include(dbot.db.ignores[item], module));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@ var command = function(dbot) {
|
||||
event.reply(dbot.t('command_ban', {'user': event.user}));
|
||||
} else {
|
||||
if(!this.api.isIgnoring(event.user, commandName) &&
|
||||
!this.api.isIgnoring(event.channel, commandName) &&
|
||||
this.api.hasAccess(event.user, commandName) &&
|
||||
dbot.commands[commandName].disabled !== true) {
|
||||
if(this.api.applyRegex(commandName, event)) {
|
||||
|
Loading…
Reference in New Issue
Block a user