From d6d33ffd63e5a3ec82ccae6ac9e8727976193cf5 Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 9 Aug 2020 02:21:05 +0300 Subject: [PATCH] missing embed perms error handling --- .../client/components/observers/CommandHandler.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/structure/client/components/observers/CommandHandler.js b/structure/client/components/observers/CommandHandler.js index 1b4b937..a04198c 100644 --- a/structure/client/components/observers/CommandHandler.js +++ b/structure/client/components/observers/CommandHandler.js @@ -394,7 +394,15 @@ class CommandHandler extends Observer { const resolved = await message.resolve(); if(resolved.error) { - this.client.logger.error(`Command Error | ${message.command.resolveable} | Message ID: ${message.id}\n${resolved.message}`); + this.client.logger.error(`Command Error | ${message.command.resolveable} | Message ID: ${message.id}\n${resolved.message || resolved.message.stack}`); + if(resolved.message.code === 50013) { + const missing = message.channel.permissionsFor(message.guild.me).missing(['EMBED_LINKS']); + if(missing.length > 0) { + return message.respond(message.format('COMMANDHANDLER_COMMAND_MISSINGPERMISSIONS'), { + emoji: 'failure' + }); + } + } return this.handleError(message, { type: 'command' }); }