fix: check customId before filter

This commit is contained in:
MARCROCK22 2025-02-17 21:47:23 -04:00
parent f74f29e96a
commit e41711770c
2 changed files with 8 additions and 8 deletions

View File

@ -19,10 +19,10 @@ export abstract class ComponentCommand {
abstract run(context: ComponentContext<typeof this.componentType>): 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)[] = [];

View File

@ -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)[] = [];