Skip to content

wc.selectionAction()

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

Parts

  • ctx Event: Context of the selection event

Parameters

  • Action Function: What it does when a selection is submitted

Setup

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

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

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

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

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

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

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

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

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

Example

quiz

wc.selectionAction( async (ctx) => {
    if (ctx.customId == "question") {
        if (ctx.values[0] == "a") {
            ctx.reply("You picked Option A!");
        }
        if (ctx.values[0] == "b") {
            ctx.reply("You picked Option B!");
        }
        if (ctx.values[0] == "c") {
            ctx.reply("You picked Option C!");
        }
        if (ctx.values[0] == "d") {
            ctx.reply("You picked Option D!");
        }
    }
});
Clone this wiki locally