Skip to content

wc.buttonAction()

paige edited this page Aug 30, 2023 · 3 revisions
  • Description: Creates a new button listener.

Parts

  • ctx Event: Context of the button event

Parameters

  • Action Function: What it does when a button is pressed

Setup

wc.buttonAction( async (ctx) => {
    // action
})

wc.event( "button", async (ctx) => {
    // action
})

wc.event( "buttonPress", async (ctx) => {
    // action
})

wc.event( "buttonPressed", async (ctx) => {
    // action
})

Example

wc.buttonAction( async (ctx) => {
    if (ctx.customId == "accept") {
        ctx.reply("Accepted!")
    }
});
Clone this wiki locally