bc58cb7361d4bfb3c545198b40c8ada08c6e3fcf
SHSF Discord Bot
Official Discord bot for the SHSF community, built with modularity and extensibility in mind. This bot provides a framework for handling commands, events, startup routines, and web endpoints, allowing for easy addition of new features.
Features
- Command Handling: Add commands in
src/commands/and register them viasrc/handlers/registerCommands.ts. - Event Listeners: Handle Discord events in
src/listeners/, grouped by event type. - Startup Routines: Add startup logic in
src/handlers/startup/and load viasrc/lib/loadStartupHandlers.ts. - Web Endpoints: Serve bot-related endpoints from
src/web/usingsrc/webserver.ts. - Centralized Configuration: Manage settings in
src/config.ts.
Project Structure
src/
commands/ # Bot commands (e.g., ping.ts)
handlers/ # Command registration & startup routines
startup/ # Startup logic (e.g., rotatingActivity.ts)
listeners/ # Discord event handlers (e.g., messageCreate/logMessage.ts)
lib/ # Shared utilities (e.g., commandRegistry.ts)
web/ # Web endpoints (e.g., gitCommit.ts)
config.ts # Bot configuration
types.ts # Type definitions
webserver.ts # Web server entry point
index.ts # Bot entry point
Getting Started
- Install dependencies:
pnpm install - Configure the bot:
Edit
src/config.tswith your Discord bot token and settings. - Run the bot:
pnpm start # or node src/index.ts
Adding Features
- New Command: Create a file in
src/commands/, register insrc/handlers/registerCommands.ts. - New Event Handler: Add a handler in the relevant
src/listeners/<Event>/folder. - Startup Routine: Implement in
src/handlers/startup/, register viasrc/lib/loadStartupHandlers.ts. - Web Endpoint: Add to
src/web/, served bysrc/webserver.ts.
Development Notes
- Uses pnpm for dependency management.
- No tests or linting scripts by default; add as needed in
package.json. - Modular structure allows easy debugging and targeted development.
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
For questions or improvements, see .github/copilot-instructions.md.
Description
Languages
TypeScript
100%