Events - Paultje52/SupaBotBase GitHub Wiki
Events are just like Functions in the file setup.
Module export
You need to export a class with at least two methods: getName()
and onExecute()
.
getName()
This method gets called when loading your event. You need to return the discord.js event name as a string.
onExecute
This method gets called when the event is triggerd, with the event parameters.
Example
module.exports = class ReadyMessage {
getEvent() {
return "ready";
}
onExecute() {
let client = this.main.client;
console.log(`\x1b[32m\x1b[1m Bot ${client.user.username} (${client.user.id}) online!\x1b[0m\n${client.channels.cache.size} channels and ${client.guilds.cache.size} guilds!`);
}
}