Skip to content

Commit

Permalink
fix(listeners): check preoconditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sawa-ko committed Sep 2, 2022
1 parent 950806b commit fdb5cf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/listeners/commands/pre-accepted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export class CoreListener extends Listener {
const { message, command, prefix } = payload;

const globalResult = await this.container.stores.get('preconditions').run(message, command, payload as any);
if (!globalResult.isErr()) {
if (globalResult.isErr()) {
this.container.client.emit(CommandEvents.CommandDenied, { ...payload, error: globalResult.err().unwrap() });
return;
}

const localResult = await command.preconditions.run(message, command, payload as any);
if (!localResult.isErr()) {
if (localResult.isErr()) {
this.container.client.emit(CommandEvents.CommandDenied, { ...payload, error: localResult.err().unwrap() });
return;
}
Expand Down

0 comments on commit fdb5cf3

Please # to comment.