Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.

wc.event()

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

Parts

  • ctx Event: Context of the event

Parameters

  • Event String: The name of the event (for a full list go here)
  • Action Function: What it does when the event occurs

Setup

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

Examples

discord.js comparison

// discord.js
client.on("ready", async (ctx) => {
    console.log(`Logged in as @${ctx.user.username} (${ctx.user.id})`);
});

// willclient
wc.event("ready", async (ctx) => {
    console.log(`Logged in as @${ctx.user.username} (${ctx.user.id})`);
});

welcome message

wc.event("join", async (ctx) => {
    let channel = await wc.fetchChannel("welcome channel ID")

    channel.send(`Welcome ${ctx.user}!`)
})

button press

wc.event("buttonPress", async (ctx) => {
    if (ctx.customId == "accept") {
        ctx.reply("Accepted!")
    }
});

Clone this wiki locally