The nerdiest Discord bot! Built with discord.py using the Cog extension system. Provides gaming integrations (WoW, League of Legends), moderation, and music playback.
# Install dependencies
uv sync
# Copy and edit configuration
cp NerdyPy/config.yaml.template NerdyPy/config.yaml
# Fill in your Discord bot token, client ID, and API keys
# Start the bot
python NerdyPy/bot.py
# Debug mode
python NerdyPy/bot.py -l DEBUGThe recommended way to run NerpyBot in production. The compose setup runs two bot instances (NerpyBot and HumanMusic) with automatic database migrations.
# Create config files from examples
cp config/nerpybot.yaml.example config/nerpybot.yaml
cp config/humanmusic.yaml.example config/humanmusic.yaml
# Edit both files with your Discord tokens and API keys# Start all services (pulls images from GHCR)
docker compose up -d
# View logs
docker compose logs -f nerpybot
docker compose logs -f humanmusic
# Stop
docker compose downMigration containers run automatically before each bot starts, applying any pending database schema changes.
To build from source instead of pulling pre-built images:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --buildTo use MariaDB/MySQL instead of SQLite, update your config file:
database:
db_type: mariadb
db_name: nerpybot
db_username: bot_user
db_password: your_password
db_host: db_host
db_port: 3306MariaDB/MySQL charset: Create the database with utf8mb4 to support emojis and full Unicode:
CREATE DATABASE nerpybot CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;Using the default utf8 charset will cause errors when storing emoji or other 4-byte Unicode characters.
Supported databases: SQLite (default), MariaDB/MySQL, PostgreSQL. For other databases, specify the type with its
driver (e.g., postgresql+psycopg2).
Migrations are managed with Alembic and run automatically in Docker Compose. For manual usage:
# Install migration dependencies
uv sync --only-group migrations
# Apply all pending migrations
uv run alembic upgrade head
# Create a new migration
uv run alembic revision --autogenerate -m "description"The migration runner resolves the database URL in this order:
DATABASE_URLenvironment variable- Bot
config.yaml(path overridable viaBOT_CONFIGenv var) alembic.inidefault (sqlite:///NerdyPy/db.db)
| Module | Description |
|---|---|
| admin | Server management, prefix configuration, command sync |
| league | Riot Games API integration |
| leavemsg | Server leave message announcements |
| moderation | Server moderation tools |
| music | Voice channel audio playback |
| reminder | Timed user reminders |
| tagging | Audio tag management |
| wow | Blizzard API integration |
Enable modules by listing them in the bot.modules section of your config file.
Copy NerdyPy/config.yaml.template (local dev) or config/*.yaml.example (Docker) and fill in:
- bot.client_id / bot.token — from the Discord Developer Portal
- bot.ops — Discord user IDs with bot admin privileges
- bot.modules — list of modules to load
- database — connection settings (see External Database)
- music / league / wow — API keys for respective services
# Lint
ruff check
# Lint with auto-fix
ruff check --fix
# Format
ruff format
# Run tests
pytest
# Run tests with coverage
pytest --covThe Dockerfile provides two targets:
# Bot image
docker buildx build --target bot -t nerpybot .
# Migrations image
docker buildx build --target migrations -t nerpybot-migrations .