51 lines
2.9 KiB
Markdown
51 lines
2.9 KiB
Markdown
# 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.
|
|
|
|
## Developer Workflows
|
|
- **Build & Run**: Use Node.js with `pnpm` for dependency management. Start the bot with `pnpm start` or `node 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 via `handlers/registerCommands.ts`.
|
|
- **Startup routines** are in `handlers/startup/` and loaded via `lib/loadStartupHandlers.ts`.
|
|
- **Web endpoints** are in `web/` and served by `webserver.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/` and `handlers/`.
|
|
|
|
## Examples
|
|
- To add a new command: Create a file in `commands/`, then ensure it's registered in `handlers/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 via `lib/loadStartupHandlers.ts`.
|
|
|
|
## References
|
|
- [src/index.ts](src/index.ts): Bot entry point
|
|
- [src/webserver.ts](src/webserver.ts): Web server entry point
|
|
- [src/handlers/registerCommands.ts](src/handlers/registerCommands.ts): Command registration
|
|
- [src/lib/commandRegistry.ts](src/lib/commandRegistry.ts): Command registry utility
|
|
- [src/listeners/messageCreate/logMessage.ts](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.**
|