ComponentHandler
Signature
export declare class ComponentHandler extends BaseHandlerPrivate types
COMPONENTSTypeAlias
type COMPONENTS = { components: { match: MatchCallback; callback: ComponentCallback; }[]; options?: ListenerOptions; messageId: string; channelId: string; guildId: string | undefined; idle?: NodeJS.Timeout; timeout?: NodeJS.Timeout; onError?: ComponentOnErrorCallback; __run: (customId: UserMatches, callback: ComponentCallback) => any;};ComponentSetTransformerTypeAlias
type ComponentSetTransformer = (component: ComponentCommands) => ComponentCommands | false | void;UserMatchesTypeAlias
type UserMatches = string | string[] | RegExp;Properties
9Methods
19Properties
protected client: UsingClient;onFail: OnFailCallback;readonly values: Map<string, COMPONENTS>;readonly modals: LimitedCollection<string, ModalSubmitCallback>;readonly commands: ComponentCommands[];filter: (path: string) => boolean;Filters a file path.
Parameters
path- The path to filter.
Returns
`true` if the path passes the filter, otherwise `false`.
private createMatchCallback;private normalizeLoadOptions;private materializeComponent;Methods
constructorConstructorconstructor(logger: Logger, client: UsingClient);createComponentCollector(messageId: string, channelId: string, guildId: string | undefined, options?: ListenerOptions, components?: COMPONENTS['components']): CreateComponentCollectorResult;onComponent(id: string, interaction: ComponentInteraction): Promise<any>;hasComponent(id: string, customId: string): boolean | undefined;resetTimeouts(id: string): void;hasModal(interaction: ModalSubmitInteraction): boolean;onModalSubmit(interaction: ModalSubmitInteraction): any;deleteValue(id: string, reason?: string): void;clearValue(id: string): COMPONENTS | undefined;establishDefaults(component: ComponentCommands): void;set(instances: SeteableComponentCommand[], optionsOrTransform?: ComponentSetTransformer | ComponentLoadOptions): ComponentCommands[];load(componentsDir: string, options?: ComponentLoadOptions): Promise<void>;reload(path: string): Promise<any>;reloadAll(stopIfFail?: boolean): Promise<void>;execute(i: ComponentCommands, context: ComponentContext | ModalContext): Promise<any>;executeComponent(context: ComponentContext): Promise<void>;executeModal(context: ModalContext): Promise<void>;onFile(file: FileLoaded<HandleableComponentCommand>): HandleableComponentCommand[] | undefined;callback(file: SeteableComponentCommand, create?: ComponentLoadCreator): ComponentCommands | false;