Events
How to create discord event listeners
Creating functions for event listeners
You can set some event options in the setupCreators
function!
To create a function for a discord event listener, use the createEvent
function
First import from the base
src/events/myevent.ts
Use the name
property to create a custom identifier for your event, then set which discord event you expect using the event
property.
All discord events are typed by the event
property, when you choose an event, the run method will be automatically typed with all the arguments that this event receives.
If you create functions for the discord ready
event, they will only execute after the bot's main ready event, including executions of the main event.
The ready
event is automatically set to once
, so the function is deleted after execution, ensuring a single execution.