import type { EmojiResolvable , Message , MessageButtonStyle } from "discord.js" ; import { randomUUID } from "node:crypto" ; import type { InteractionContext } from "../interaction-context" ; /**
 * Options for  buttonComponent export type ButtonComponentOptions = { /**
     * The text to display on the button
     */ label : string ; see https emoji ? : EmojiResolvable ; see https style : Exclude < MessageButtonStyle , "LINK" > ; /**
     * Whether the button is disabled.
     * This can be anti-accessibility, so consider an alternative,
     * like showing an error on click, or hiding the button entirely.
     */ disabled ? : boolean ; /**
     * Called when the button is clicked
     */ onClick : ( context : ButtonInteractionContext ) => unknown ; } ; /**
 * Returned from  buttonComponent export type ButtonComponent = ButtonComponentOptions & { type : "button" ; customId : string ; } ; /**
 * The context object received by button onClick handlers.
 * See  buttonComponent export type ButtonInteractionContext = InteractionContext & { readonly message : Message ; } ; /**
 * Represents a discord [button](https://discord.com/developers/docs/interactions/message-components#buttons) component.
 * Does not support URL or disabled props yet.
 *
 * ```js
 * context.reply(() => (
 *   buttonComponent({
 *     label: "Click me!",
 *     onClick: context => {
 *       context.reply(() => "You clicked me!"),
 *     },
 *   }),
 * ))
 * ```
 */ export function buttonComponent ( options ) { return { ... options , type : "button" , customId : randomUUID ( ) , } ; }