mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 13:36:08 +00:00

* feat: add support for new Discord application emojis features * feat: add support for new Discord application emojis features * feat: applications emojis routes * chore: switch typings provider * fix: unnecesary type * feat: magic bytes * chore: move api-types * chore: ? * fix: omg npm * chore: apply formatting * fix: for fast merge --------- Co-authored-by: Tony Supremacy <165050835+VanStk@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { ComponentType } from '../types';
|
|
import type { ContextComponentCommandInteractionMap, ComponentContext } from './componentcontext';
|
|
import type { ExtraProps, RegisteredMiddlewares, UsingClient } from '../commands';
|
|
|
|
export const InteractionCommandType = {
|
|
COMPONENT: 0,
|
|
MODAL: 1,
|
|
} as const;
|
|
|
|
export interface ComponentCommand {
|
|
__filePath?: string;
|
|
}
|
|
|
|
export abstract class ComponentCommand {
|
|
type = InteractionCommandType.COMPONENT;
|
|
abstract componentType: keyof ContextComponentCommandInteractionMap;
|
|
abstract filter(context: ComponentContext<typeof this.componentType>): Promise<boolean> | boolean;
|
|
abstract run(context: ComponentContext<typeof this.componentType>): any;
|
|
|
|
middlewares: (keyof RegisteredMiddlewares)[] = [];
|
|
|
|
props!: ExtraProps;
|
|
|
|
get cType(): number {
|
|
return ComponentType[this.componentType];
|
|
}
|
|
|
|
onAfterRun?(context: ComponentContext, error: unknown | undefined): any;
|
|
onRunError?(context: ComponentContext, error: unknown): any;
|
|
onMiddlewaresError?(context: ComponentContext, error: string): any;
|
|
onInternalError?(client: UsingClient, error?: unknown): any;
|
|
}
|