From e41711770cbe50c0ff91ebfedbbddb35cb5f82af Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Mon, 17 Feb 2025 21:47:23 -0400 Subject: [PATCH] fix: check customId before filter --- src/components/componentcommand.ts | 8 ++++---- src/components/modalcommand.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/componentcommand.ts b/src/components/componentcommand.ts index a81aa23..60cba08 100644 --- a/src/components/componentcommand.ts +++ b/src/components/componentcommand.ts @@ -19,10 +19,10 @@ export abstract class ComponentCommand { abstract run(context: ComponentContext): any; /** @internal */ - async _filter(context: ComponentContext) { - const old = (await this.filter?.(context)) ?? true; - if (this.customId) return this.customId === context.customId && old; - return old; + _filter(context: ComponentContext) { + if (this.customId && this.customId !== context.customId) return false; + if (this.filter) return this.filter(context); + return true; } middlewares: (keyof RegisteredMiddlewares)[] = []; diff --git a/src/components/modalcommand.ts b/src/components/modalcommand.ts index 00448f9..af50764 100644 --- a/src/components/modalcommand.ts +++ b/src/components/modalcommand.ts @@ -13,10 +13,10 @@ export abstract class ModalCommand { abstract run(context: ModalContext): any; /** @internal */ - async _filter(context: ModalContext) { - const old = (await this.filter?.(context)) ?? true; - if (this.customId) return this.customId === context.customId && old; - return old; + _filter(context: ModalContext) { + if (this.customId && this.customId !== context.customId) return false; + if (this.filter) return this.filter(context); + return true; } middlewares: (keyof RegisteredMiddlewares)[] = [];