missing embed perms error handling

This commit is contained in:
Erik 2020-08-09 02:21:05 +03:00
parent 12e2660bf7
commit d6d33ffd63

View File

@ -394,7 +394,15 @@ class CommandHandler extends Observer {
const resolved = await message.resolve(); const resolved = await message.resolve();
if(resolved.error) { 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' }); return this.handleError(message, { type: 'command' });
} }