The official RetroAchievements Discord bot.
RABot is the official RetroAchievements Discord bot. It serves the RetroAchievements community with various utility commands, polls, and integration features.
RABot utilizes:
- The Bun runtime for high speed, low memory footprint, and native TS execution
- TypeScript for static type safety
- Discord.js for tight integration with Discord
- Drizzle ORM with SQLite for data persistence
- @retroachievements/api for web API calls
- Bun 1.3.6+
- A Discord bot token
Clone the repository and install dependencies:
git clone https://github.com/RetroAchievements/RABot-Next.git
cd RABot-Next
bun installCopy the example environment file and fill in your values:
cp .env.example .envThen edit .env with your configuration:
DISCORD_TOKEN- Your bot's token from Discord Developer PortalDISCORD_APPLICATION_ID- Your bot's application ID from Discord Developer PortalLEGACY_COMMAND_PREFIX- Command prefix for legacy commands (default:!)RA_WEB_API_KEY- Your RetroAchievements Web API keyYOUTUBE_API_KEY- Your YouTube Data API v3 key (optional, for/ganlongplay searches)MAIN_GUILD_ID- Discord guild ID for the main RetroAchievements serverWORKSHOP_GUILD_ID- Discord guild ID for the RetroAchievements Workshop serverUWC_VOTING_TAG_ID- Forum tag ID for active UWC polls (optional)UWC_VOTE_CONCLUDED_TAG_ID- Forum tag ID for completed UWC polls (optional)UWC_FORUM_CHANNEL_ID- Forum channel ID for UWC auto-detection (optional)AUTO_PUBLISH_CHANNEL_IDS- Comma-separated list of announcement channel IDs to auto-publish from (optional)NODE_ENV- Environment mode:developmentorproduction(default:development)LOG_LEVEL- Logging level:trace,debug,info,warn,error,fatal(default:debugin dev,infoin prod)
Initialize the database:
bun db:generate # Generate migration files
bun db:migrate # Apply migrations
bun db:seed # Seed default teams (optional)After adding your bot to a server, deploy the slash commands:
bun deploy-commandsThis needs to be run:
- When you first set up the bot
- Whenever you add or modify slash commands
- After major Discord.js updates
bun dev # Runs with auto-restart on file changesbun start # Standard runFor production deployments, the bot is automatically deployed via Forge when changes are merged to the main branch. The bot runs under a process supervisor on the production server.
bun dev- Run in development mode with hot reloadbun start- Run in production modebun deploy-commands- Deploy slash commands to Discordbun db:generate- Generate database migrationsbun db:migrate- Apply database migrationsbun run format- Format code with oxfmtbun run format:check- Check formatting without writingbun lint- Run oxlintbun lint:fix- Run oxlint with auto-fixbun tsc- Run TypeScript type checking (via tsgo)bun run test- Run all testsbun run test:watch- Run tests in watch modebun verify- Run format check, lint, type checking, and tests
RABot is transitioning to slash commands! When you use a legacy prefix command (e.g., !gan), you'll see a migration notice encouraging you to use the modern slash command version (e.g., /gan). The legacy command will still work during the transition period.
/topic- Display the current channel topic/contact- Show contact information for various RA teams/status- Display bot status and statistics/poll- Create a simple poll (up to 10 options)/tpoll- Create a timed poll that automatically closes/gan <game-id>- Generate achievement news template/gan2 <game-id>- Generate pretty achievement news template with colors/pingteam- Team management system (Workshop server only)/pingteam ping <team>- Ping all members of a team/pingteam add <team> <user>- Add user to team (admin only)/pingteam remove <team> <user>- Remove user from team (admin only)/pingteam create <name>- Create a new team (admin only)
/uwc- Create an Unwelcome Concept poll (Workshop server only, auto-manages forum tags)- Auto-detection: When a new UWC thread is created in the configured forum channel with format
12345: Achievement Title (Game Name), the bot automatically posts links to previous discussions for that achievement
- Auto-detection: When a new UWC thread is created in the configured forum channel with format
/dadjoke- Get a random dad joke/frames <input>- Convert between time and frames at different frame rates
The bot still supports the following legacy prefix commands (all prefixed with ! by default):
!topic- Display the current channel topic!rule [number]- Display server rules!contact- Show contact information for various RA teams!poll- Create a simple poll!tpoll- Create a timed poll!gan <game_id>- Generate achievement news template!mem <achievement_id|achievement_url|memaddr>- Parse MemAddr strings and show achievement logic!dadjoke- Get a random dad joke!frames <time|frames> [fps]- Convert between time and frames at different frame rates
src/
βββ commands/ # Legacy prefix commands (*.command.ts files)
βββ slash-commands/ # Modern slash commands (*.command.ts files)
βββ config/ # Configuration and constants
βββ database/ # Database setup and schemas
βββ handlers/ # Message and event handlers
βββ models/ # TypeScript interfaces and types
βββ services/ # Business logic services
βββ utils/ # Utility functions and logging
Contributions are welcome! Please see our Contributing Guide for detailed information on:
- Setting up your development environment
- Development workflow and standards
- Submitting pull requests
- Code style and project structure
For quick questions, feel free to open an issue or ask in our Discord server!