Adding an Event Handler
This guide walks through adding a new Discord event handler in TomoriBot.
-
Create a folder under
src/events/{folderName}if one does not already exist for the event type. -
Add the handler file with a default export function. The function signature should match the Discord.js event payload for the target event.
-
Map the Discord event name to the folder in
src/handlers/eventHandler.tsinsideeventFolderMap. -
Restart the dev server and verify the event fires in logs.
Quality Gate
Section titled “Quality Gate”bun run check # TypeScript strict modebun run lint # Biome formattingThen trigger the event in Discord (join a server, send a message, etc.) and confirm the handler runs without errors.
Related Docs
Section titled “Related Docs”docs/subsystems/event-system.md— event registration pattern, handler conventions