A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy
at develop 22 lines 652 B view raw
1import type { ButtonInteraction } from "discord.js"; 2import type { Context } from "../core/context"; 3import type { Middleware } from "../types/Middleware"; 4 5export interface ButtonOptions { 6 id: string; 7 use?: Middleware<ButtonInteraction>[]; 8 execute: (ctx: Context<ButtonInteraction>) => Promise<void>; 9} 10 11export class Button { 12 readonly type = "button" as const; 13 readonly id: string; 14 readonly use?: Middleware<ButtonInteraction>[]; 15 readonly execute: (ctx: Context<ButtonInteraction>) => Promise<void>; 16 17 constructor(options: ButtonOptions) { 18 this.id = options.id; 19 this.use = options.use; 20 this.execute = options.execute; 21 } 22}