A guide for using events in ShadowCore.
/events
directory.
Example Folder Structure:
Event
instance and specify the event name (name
), the function to run when the event triggers (run
), and whether the event should only trigger once (once
).
Here’s an example of creating a ready
event that registers commands when the bot is ready:
messageCreate
event to listen for new messages and respond accordingly.
Example of handling the messageCreate
event:
name
is "messageCreate"
, which triggers when a new message is sent.run
function checks if the message content is !ping
and replies with "Pong!"
.ready
, messageCreate
, and interactionCreate
are just a few examples of the available events. You can register any event that Discord.js supports.