mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
Add accessOutput command to tell users when they are not authorised to run a command [#467]
This commit is contained in:
parent
d9850d19d5
commit
9847a05301
@ -25,9 +25,11 @@ var command = function(dbot) {
|
||||
dbot.api.ignore.isUserBanned(event.server, event.user, commandName, function(isBanned) {
|
||||
if(isBanned) {
|
||||
event.reply(dbot.t('command_ban', {'user': event.user}));
|
||||
} else if(!isIgnoring &&
|
||||
hasAccess &&
|
||||
dbot.commands[commandName].disabled !== true) {
|
||||
} else if(!hasAccess) {
|
||||
if(this.config.accessOutput) {
|
||||
event.reply(dbot.t('access_denied', { 'user': event.user }));
|
||||
}
|
||||
} else if(!isIgnoring && !dbot.commands[commandName].disabled) {
|
||||
if(this.api.applyRegex(commandName, event)) {
|
||||
try {
|
||||
var command = dbot.commands[commandName];
|
||||
@ -45,7 +47,7 @@ var command = function(dbot) {
|
||||
});
|
||||
}
|
||||
}
|
||||
if(commandName != 'reload') dbot.api.event.emit('command', [ event ]);
|
||||
if(_.include(commandName, ['reload', 'load', 'unload'])) dbot.api.event.emit('command', [ event ]);
|
||||
dbot.save();
|
||||
} else {
|
||||
if(commandName !== '~') {
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"ignorable": false,
|
||||
"dependencies": [ "event", "ignore", "users" ],
|
||||
"useNickserv": false
|
||||
"useNickserv": false,
|
||||
"accessOutput": false
|
||||
}
|
||||
|
@ -36,5 +36,8 @@
|
||||
"loaded_modules": {
|
||||
"en": "Loaded modules: {modules}.",
|
||||
"nl": "Geladen modules: {modules}."
|
||||
},
|
||||
"access_denied": {
|
||||
"en": "{user}: You don't have the access level to run this command."
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user