Show the missing permissions

merge-requests/3/head
loicbersier 6 years ago
parent 171338d8d5
commit b7ec53a11e

@ -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;
}
}
}

@ -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;
Loading…
Cancel
Save