@jadl/cmd
Version:
A command handler for JADL
27 lines (26 loc) • 1.23 kB
TypeScript
import { MessageBuilder } from '@jadl/builders';
import { APIMessageComponentInteraction } from 'discord-api-types/v10';
import { APIButtonComponentWithCustomId, APIButtonComponentBase, ButtonStyle, APIInteraction } from 'discord-api-types/v9';
import { Worker } from 'jadl';
import { WorkerInject } from '../structures/WorkerInject';
interface SectionOptions {
row: number;
disableIf?: string[];
}
interface SectionData {
method: string;
button: APIButtonComponentWithCustomId;
options: SectionOptions;
}
declare const sectionsSymbol: unique symbol;
declare type SectionEnabledObject = {
[sectionsSymbol]: SectionData[];
};
export declare class ButtonMenu<D extends any = {}, W extends Worker = Worker> extends WorkerInject<W> implements SectionEnabledObject {
[sectionsSymbol]: SectionData[];
_onInteraction(int: APIInteraction, worker: W): Promise<void>;
private createButtons;
start(section: string, data: D, interaction?: APIMessageComponentInteraction): Promise<MessageBuilder>;
}
export declare const Section: (button: Omit<APIButtonComponentBase<Exclude<ButtonStyle, ButtonStyle.Link>>, 'type'>, options?: SectionOptions) => MethodDecorator;
export {};