should not respond in ignored channel even for inhibitor errors
This commit is contained in:
parent
97bf057503
commit
68f2fef16e
@ -712,6 +712,15 @@ class Resolver {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves input into an emoji, either a custom or a unicode emoji. Returned object will have a type property indicating whether it's custom or unicode.
|
||||
*
|
||||
* @param {Array<String>} [resolveables=[]]
|
||||
* @param {boolean} strict
|
||||
* @param {Guild} guild
|
||||
* @return {Object}
|
||||
* @memberof Resolver
|
||||
*/
|
||||
async resolveEmojis(resolveables = [], strict, guild) {
|
||||
|
||||
if (typeof resolveables === 'string') resolveables = [resolveables];
|
||||
|
@ -389,15 +389,16 @@ class CommandHandler extends Observer {
|
||||
const silent = inhibitors.filter((i) => i.inhibitor.silent);
|
||||
const nonsilent = inhibitors.filter((i) => !i.inhibitor.silent);
|
||||
|
||||
if(nonsilent.length === 0 && silent.length > 0) return undefined;
|
||||
if(nonsilent.length > 0) return this.handleError(message, { type: 'inhibitor', ...nonsilent[0] });
|
||||
if (silent.length && silent.some((result) => result.inhibitor.id === 'channelIgnore')) return;
|
||||
if (nonsilent.length === 0 && silent.length > 0) return undefined;
|
||||
if (nonsilent.length > 0) return this.handleError(message, { type: 'inhibitor', ...nonsilent[0] });
|
||||
|
||||
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.stack || resolved.message}`);
|
||||
if(resolved.message.code === 50013) {
|
||||
if (resolved.message.code === 50013) {
|
||||
const missing = message.channel.permissionsFor(message.guild.me).missing(['EMBED_LINKS']);
|
||||
if(missing.length > 0) {
|
||||
if (missing.length > 0) {
|
||||
return message.respond(message.format('COMMANDHANDLER_COMMAND_MISSINGPERMISSIONS'), {
|
||||
emoji: 'failure'
|
||||
});
|
||||
@ -428,7 +429,7 @@ class CommandHandler extends Observer {
|
||||
const reasons = (await Promise.all(promises)).filter((p) => p.error); // Filters out inhibitors with only errors.
|
||||
if(reasons.length === 0) return [];
|
||||
|
||||
reasons.sort((a, b) => b.inhibitor.priority - a.inhibitor.priority); // Sorts inhibitor errors by most important.
|
||||
reasons.sort((a, b) => a.inhibitor.priority - b.inhibitor.priority); // Sorts inhibitor errors by most important.
|
||||
return reasons;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user