Skip to content

wc.commandAction()

paige edited this page Aug 30, 2023 · 2 revisions
  • Description: Creates a new slash command listener.

Parts

  • ctx Interaction: Context of the command's interaction
  • cmd Command: Info about the command like name, arguments, cooldown, etc

Parameters

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

Setup

wc.commandAction( async (ctx, cmd) => {
    // action
})

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

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

Example

wc.commandAction( async (ctx, cmd) => {
    if (cmd.name == "ping") {
        ctx.reply("Pong!")
    }
});
Clone this wiki locally