diff --git a/structure/client/Dispatcher.js b/structure/client/Dispatcher.js index 4e766ab..de95795 100644 --- a/structure/client/Dispatcher.js +++ b/structure/client/Dispatcher.js @@ -10,7 +10,7 @@ class Dispatcher { const observers = this.client.registry.components .filter((c) => c.type === 'observer' && !c.disabled) - .sort((a, b) => b.priority - a.priority); + .sort((a, b) => a.priority - b.priority); for(const observer of observers.values()) { for(const [hook, func] of observer.hooks) { diff --git a/structure/client/components/observers/CommandHandler.js b/structure/client/components/observers/CommandHandler.js index 4f36a61..c2453d9 100644 --- a/structure/client/components/observers/CommandHandler.js +++ b/structure/client/components/observers/CommandHandler.js @@ -366,6 +366,7 @@ class CommandHandler extends Observer { async handleCommand(message) { const inhibitor = await this._handleInhibitors(message); + //console.log(inhibitor); if(inhibitor.error) return this.handleError(message, { type: 'inhibitor', ...inhibitor }); const resolved = await message.resolve(); @@ -396,7 +397,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 { error: false }; - 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[0]; } @@ -553,7 +554,8 @@ class CommandHandler extends Observer { } }; - return message.respond(await messages[error.type](error), { emoji: 'failure' }); + //return this.client.rateLimiter.limitSend(message.channel, await messages[error.type](error)); + return message.limitedRespond(await messages[error.type](error), { emoji: 'failure' }); }