2.9 KiB
2.9 KiB
Copilot Instructions for AI Coding Agents
Project Overview
This is a TypeScript-based Discord bot project, organized for modularity and clarity. The bot is structured to support command handling, event listeners, web endpoints, and startup routines.
Architecture & Key Components
- src/: Main source directory.
- commands/: Each file implements a bot command (e.g.,
ping.ts). - handlers/: Contains logic for registering commands and startup routines.
- listeners/: Event-driven handlers for Discord events, organized by event type (e.g.,
GuildMemberAdd,messageCreate). - lib/: Shared utilities for command registration and startup handler loading.
- web/: Web endpoints for bot-related actions (e.g.,
gitCommit.ts). - config.ts: Central configuration file.
- types.ts: Project-specific type definitions.
- webserver.ts: Entry point for the web server.
- index.ts: Main bot entry point.
- commands/: Each file implements a bot command (e.g.,
Developer Workflows
- Build & Run: Use Node.js with
pnpmfor dependency management. Start the bot withpnpm startornode src/index.ts. - Debugging: Modular structure allows targeted debugging. Focus on the relevant handler or listener for the event/command.
- No tests or linting scripts: If needed, add them to
package.json.
Project Conventions
- Event listeners are grouped by event type in subfolders under
listeners/. - Commands are implemented as individual files in
commands/and registered viahandlers/registerCommands.ts. - Startup routines are in
handlers/startup/and loaded vialib/loadStartupHandlers.ts. - Web endpoints are in
web/and served bywebserver.ts. - Type definitions are centralized in
types.ts. - Configuration is managed in
config.ts.
Integration & Communication
- Discord.js (or similar) is assumed for bot interaction, though not explicitly shown.
- Webserver integrates with bot logic via endpoints in
web/. - Command and event registration is handled via utility files in
lib/andhandlers/.
Examples
- To add a new command: Create a file in
commands/, then ensure it's registered inhandlers/registerCommands.ts. - To handle a new Discord event: Add a handler in the appropriate
listeners/<Event>/folder. - To add a startup routine: Implement in
handlers/startup/and register vialib/loadStartupHandlers.ts.
References
- src/index.ts: Bot entry point
- src/webserver.ts: Web server entry point
- src/handlers/registerCommands.ts: Command registration
- src/lib/commandRegistry.ts: Command registry utility
- src/listeners/messageCreate/logMessage.ts: Example event handler
Review and update these instructions as the project evolves. If any section is unclear or incomplete, please provide feedback for improvement.