Send the missing perm in DM if the bot can't send messages

This commit is contained in:
loicbersier 2019-11-09 12:14:54 +01:00
parent b68dcc5ce7
commit 2c43a6835e

View file

@ -9,14 +9,21 @@ class missingPermissionsListener extends Listener {
}
async exec(message, command, type, missing) {
if (missing == 'SEND_MESSAGES') return; // If bot can't send messages just do nothing
switch(type) {
case 'client':
message.reply(`Im missing the required permissions for this command!, \`${missing}\``);
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}\``);
}
break;
case 'user':
message.reply(`You are missing some permissions to use this command!, \`${missing}\``);
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}\``);
}
break;
}
}