mirror of
https://github.com/reality/dbot.git
synced 2025-02-17 14:01:04 +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) {
|
dbot.api.ignore.isUserBanned(event.server, event.user, commandName, function(isBanned) {
|
||||||
if(isBanned) {
|
if(isBanned) {
|
||||||
event.reply(dbot.t('command_ban', {'user': event.user}));
|
event.reply(dbot.t('command_ban', {'user': event.user}));
|
||||||
} else if(!isIgnoring &&
|
} else if(!hasAccess) {
|
||||||
hasAccess &&
|
if(this.config.accessOutput) {
|
||||||
dbot.commands[commandName].disabled !== true) {
|
event.reply(dbot.t('access_denied', { 'user': event.user }));
|
||||||
|
}
|
||||||
|
} else if(!isIgnoring && !dbot.commands[commandName].disabled) {
|
||||||
if(this.api.applyRegex(commandName, event)) {
|
if(this.api.applyRegex(commandName, event)) {
|
||||||
try {
|
try {
|
||||||
var command = dbot.commands[commandName];
|
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();
|
dbot.save();
|
||||||
} else {
|
} else {
|
||||||
if(commandName !== '~') {
|
if(commandName !== '~') {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ignorable": false,
|
"ignorable": false,
|
||||||
"dependencies": [ "event", "ignore", "users" ],
|
"dependencies": [ "event", "ignore", "users" ],
|
||||||
"useNickserv": false
|
"useNickserv": false,
|
||||||
|
"accessOutput": false
|
||||||
}
|
}
|
||||||
|
@ -36,5 +36,8 @@
|
|||||||
"loaded_modules": {
|
"loaded_modules": {
|
||||||
"en": "Loaded modules: {modules}.",
|
"en": "Loaded modules: {modules}.",
|
||||||
"nl": "Geladen modules: {modules}."
|
"nl": "Geladen modules: {modules}."
|
||||||
|
},
|
||||||
|
"access_denied": {
|
||||||
|
"en": "{user}: You don't have the access level to run this command."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user