Show the missing permissions

This commit is contained in:
loicbersier 2019-01-14 11:33:01 +01:00
parent 171338d8d5
commit b7ec53a11e
2 changed files with 29 additions and 7 deletions

View file

@ -8,25 +8,24 @@ class CommandBlockedListener extends Listener {
});
}
exec(message, command, reason) {
async exec(message, command, reason) {
console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`);
let ownerMessage;
switch(reason) {
case 'Owner':
case 'owner':
ownerMessage = ['Nice try but you aren\'t the owner <a:memed:433320880135733248>', 'LOADING SUPER SECRET COMMAND <a:loadingmin:527579785212329984> Wait a minute... you aren\'t the owner!', 'uhm, how about no'];
ownerMessage = ownerMessage[Math.floor( Math.random() * ownerMessage.length )];
message.reply(ownerMessage);
break;
case 'clientPermissions':
message.reply('Im missing the required permissions for this command!');
case 'guild':
message.reply('You can\'t use this command in a guild!');
break;
case 'userPermissions':
message.reply('You are missing some permissions to use this command!');
case 'dm':
message.reply('You can\'t use this command in DM!');
break;
case 'blacklist':
message.reply('You can\'t use this command because you have been blacklisted!');
break;
}
}
}

View file

@ -0,0 +1,23 @@
const { Listener } = require('discord-akairo');
class missingPermissionsListener extends Listener {
constructor() {
super('missingPermissions', {
emitter: 'commandHandler',
event: 'missingPermissions'
});
}
async exec(message, command, type, missing) {
switch(type) {
case 'client':
message.reply(`Im missing the required permissions for this command!, \`${missing}\``);
break;
case 'user':
message.reply(`You are missing some permissions to use this command!, \`${missing}\``);
break;
}
}
}
module.exports = missingPermissionsListener;