Event Basics - shysolocup/willclient GitHub Wiki
Events work differently than Discord.JS because they have their own list of custom events such as button and select menu events
For a full list of events go here or use wc.eventList
Events while working differently are cross compatible with Discord.JS' client.on() function the only main difference is the fact that wc has custom events.
In this example it logs the bot's username and ID
// 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})`);
});
Events can be used to do things like respond to buttons like in this example
wc.event("buttonPress", async (ctx) => {
if (ctx.customId == "accept") {
ctx.reply("Accepted!")
}
});
// or
wc.buttonAction( async (ctx) => {
if (ctx.customId == "accept") {
ctx.reply("Accepted!")
}
});