2019-01-14 11:33:01 +01:00
|
|
|
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':
|
2019-11-09 12:14:54 +01:00
|
|
|
if (missing == 'SEND_MESSAGES') {
|
|
|
|
return message.author.send(`Im missing the required permissions for this command!, \`${missing}\``);
|
|
|
|
} else {
|
|
|
|
message.reply(`Im missing the required permissions for this command!, \`${missing}\``);
|
|
|
|
}
|
2019-01-14 11:33:01 +01:00
|
|
|
break;
|
|
|
|
case 'user':
|
2019-11-09 12:14:54 +01:00
|
|
|
if (missing == 'SEND_MESSAGES') {
|
|
|
|
return message.author.send(`You are missing some permissions to use this command!, \`${missing}\``);
|
|
|
|
} else {
|
|
|
|
message.reply(`You are missing some permissions to use this command!, \`${missing}\``);
|
|
|
|
}
|
|
|
|
|
2019-01-14 11:33:01 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = missingPermissionsListener;
|