From 2c43a6835e8dbeebc48abecb2bb24fdf9a20ba86 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 9 Nov 2019 12:14:54 +0100 Subject: [PATCH] Send the missing perm in DM if the bot can't send messages --- event/listeners/missingPermissions.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/event/listeners/missingPermissions.js b/event/listeners/missingPermissions.js index 9c6bace..a991d56 100644 --- a/event/listeners/missingPermissions.js +++ b/event/listeners/missingPermissions.js @@ -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; } }