mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-17 04:13:28 +00:00
* perf: optimize members cache * feat: components V2 (#337) * feat: components v2 * fix: build * chore: apply formatting * refactor(components): some types * refactor(types): replace TopLevelComponents with APITopLevelComponent in REST * fix: unify components * refactor(TextDisplay): rename content method to setContent for clarity * refactor(builders): add missing builder from component * fix: touche * feat(webhook): webhook params for components v2 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: use protected instead of private * fix(editOrReply): accept flags when editing message * feat: add onBeforeMiddlewares and onBeforeOptions (#338) * chore: package version --------- Co-authored-by: MARCROCK22 <marcos22dev@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MARCROCK22 <57925328+MARCROCK22@users.noreply.github.com>
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import type { ExtraProps, RegisteredMiddlewares, UsingClient } from '../commands';
|
|
import { InteractionCommandType } from './componentcommand';
|
|
import type { ModalContext } from './modalcontext';
|
|
|
|
export interface ModalCommand {
|
|
__filePath?: string;
|
|
}
|
|
|
|
export abstract class ModalCommand {
|
|
type = InteractionCommandType.MODAL;
|
|
filter?(context: ModalContext): Promise<boolean> | boolean;
|
|
customId?: string;
|
|
abstract run(context: ModalContext): any;
|
|
|
|
/** @internal */
|
|
_filter(context: ModalContext) {
|
|
if (this.customId && this.customId !== context.customId) return false;
|
|
if (this.filter) return this.filter(context);
|
|
return true;
|
|
}
|
|
|
|
middlewares: (keyof RegisteredMiddlewares)[] = [];
|
|
|
|
props!: ExtraProps;
|
|
|
|
onBeforeMiddlewares?(context: ModalContext): any;
|
|
onAfterRun?(context: ModalContext, error: unknown | undefined): any;
|
|
onRunError?(context: ModalContext, error: unknown): any;
|
|
onMiddlewaresError?(context: ModalContext, error: string): any;
|
|
onInternalError?(client: UsingClient, error?: unknown): any;
|
|
}
|