A custom Discord bot for the Hard Carry Club, built with Bun, Dressed, and TypeScript.
You'll need one of the following development environments:
Option 1: GitHub Codespaces (Recommended)
- No local setup required
- Review the Codespaces billing documentation first
Option 2: Local Dev Containers
- Create a new Discord application
- Copy the bot token (from the bot section), application ID, and public key
- Set up a test Discord server with:
- A channel for user notes
- A role for staff members
- A role for banned users
It should be automatically created but you should have a .env
that looks similar to this:
DISCORD_TOKEN="your_bot_token_here"
GUILD_ID="your_test_server_id"
PUG_BANNED_ROLE_ID="banned_role_id"
PUG_STAFF_ROLE_ID="staff_role_id"
PUG_NOTES_CHANNEL_ID="notes_channel_id"
The dev container should automatically run setup, but if needed, run manually:
bun install && bun run lefthook install
After pulling new changes, always run:
bun install
-
Register Discord commands (required for new/changed commands):
bun run bot:register-commands
-
Start the development server:
bun run dev
-
Configure Discord webhook (one-time setup):
- Forward port in VS Code
- Right-click the port → Port Visibility → Public
- Copy the public URL
- Paste into
Interactions Endpoint URL
in your Discord application settings - Note: The bot must be running when you save this setting as Discord will validate it's working correctly
When making commits you should always follow conventional commit format. If you wanna quick cheat sheet checkout this post. There will be a check automatically ran as you stage and commit code to GitHub to ensure it follows this format.
If you use Copilot you can autogenerate a commit and it should follow this standard as well.
The dev container includes these helpful extensions:
- SQLite Viewer - Double-click
db.sqlite
to view the database - GitHub Copilot - AI code assistance (if you have access)
- Biome - Automatic formatting and linting
- Additional: Icons, spell check, and inline error viewing
Dressed Framework
Discord Formatting
-
Uses
discord-fmt
package -
Example usage:
import { bold, h1 } from "discord-fmt"; sendMessage(bold("this is bold")); // **this is bold** sendMessage(h1("Header")); // # Header sendMessage(bold("sh*t")); // **sh\*t**
Formatting & Linting
- Biome handles formatting and linting
- Lefthook runs checks automatically on commit
- Format on save enabled if you're using Codespaces or VSCode
If you want to include images, it's highly recommended to upload them to something like Imgur, if you worry about it disappearing then contact me in Discord and I'll throw it on the HCC CDN.
Common Issues:
- Commands not updating: Run
bun run bot:register-commands
after changes - Webhook errors: Ensure port is public and bot is running when configuring Discord
- Permission errors: Check bot permissions in your test server
- Environment issues: Verify all required environment variables are set