A feature-rich Discord bot built with discord.py that provides utility commands and can be easily extended with additional functionality.
- Slash Commands: Modern Discord slash command support
- Jeopardy Game: Interactive Jeopardy game with authentic questions from actual TV episodes
- Basic Utility Commands: Ping, help, info, random number generation, user information
- Error Handling: Comprehensive error handling with user-friendly messages
- Logging: Detailed logging system with file and console output
- Database Integration: PostgreSQL database for persistent storage
- Extensible: Easy to add new commands and features
- Production Ready: Proper token management and security practices
/ping- Check bot latency and response time/help- Display all available commands/info- Show detailed bot information and statistics/random [maximum]- Generate a random number (1 to maximum, default 100)/userinfo [user]- Display information about a user
/clue- Start a new Jeopardy game with a random question from actual TV episodes/end_game- End the current game in the channel (moderators only)/jeopardy_stats- Show statistics about the question database
- Python 3.11 or higher
- PostgreSQL database
- Discord bot token
- Set up environment variables:
cp .env.example .env
# Edit .env with your actual values- Deploy compose project:
docker compose up -d- Populate the database:
docker exec xelbot xelbot db populate- Build and install the executable:
pip install .- Set up environment variables:
cp .env.example .env
# Edit .env with your actual values- Populate the database:
xelbot db populate- Run the bot:
xelbot run- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section and click "Add Bot"
- Important: Under "Privileged Gateway Intents", enable:
- Message Content Intent (required for game responses)
- Server Members Intent (optional, for user info commands)
- Copy the bot token (keep this secure!)
Local PostgreSQL
# Install PostgreSQL on your system
# Create a database
createdb xelbot
# Update DATABASE_URL in .env:
DATABASE_URL=postgresql://username:password@localhost:5432/xelbotCopy .env.example to .env and fill in your values.
- In Discord Developer Portal, go to OAuth2 > URL Generator
- Select scopes:
botandapplications.commands - Select bot permissions:
- Send Messages
- Use Slash Commands
- Embed Links
- Read Message History
- Use the generated URL to invite your bot
Check database status:
xelbot db infoPopulate database questions:
xelbot db populateReset database:
# Warning: This deletes all data
python -c "from xelbot.database.models import *; create_tables()"- Create a new file in the
commands/directory - Follow the existing pattern with proper error handling
- Add the cog to the bot in
bot.py - Update this README with command documentation
For issues and questions:
- Check the troubleshooting section above
- Review the logs in the
logs/directory - Ensure all environment variables are properly configured
- Verify database connectivity and table creation