A Discord bot that fetches and displays IMDb movie/TV show information.
- Automatically detects IMDb links in Discord messages
- Fetches movie data from OMDB API
- Stores data in Supabase for persistence
- Enhanced Community Rating System:
- Multi-user ratings via emoji reactions (1️⃣-9️⃣, 🔟)
- 1-10 rating scale (industry standard)
- Real-time average calculations
- Duplicate prevention per user
- Cache-independent reaction handling
- Guild-specific channel configuration
- Comprehensive error handling and logging
This project uses Supabase for data storage and includes database migrations for schema management.
- Node.js and npm (for Supabase CLI)
- Supabase account and project
-
Install Supabase CLI (if not already installed):
npm install supabase --save-dev
-
Link to your Supabase project:
npx supabase link --project-ref YOUR_PROJECT_REF
Get your project ref from your Supabase dashboard URL (the part before
.supabase.co). -
Apply migrations to remote database:
npx supabase db push
This applies all migration files in
supabase/migrations/to your remote Supabase database.
When you need to modify the database schema:
-
Create a new migration file:
npx supabase migration new migration_name
-
Edit the generated SQL file in
supabase/migrations/ -
Apply locally (optional):
npx supabase db reset
-
Push to remote:
npx supabase db push
The bot automatically validates database schema on startup. If required tables are missing, it will log an error and exit gracefully, preventing runtime failures.
-
Clone the repository
git clone https://github.com/your-username/python-imdb-bot.git cd python-imdb-bot -
Install dependencies using uv
# Install uv (if not already installed) pip install uv # Install project dependencies uv sync
-
Set up environment variables
cp .env.example .env # Edit .env with your API keys and configuration -
Apply database migrations
npx supabase db push
-
Run the bot
uv run python main.py
# Build the image
docker build -t python-imdb-bot .
# Run with environment variables
docker run -e DISCORD_TOKEN=your_token \
-e SUPABASE_URL=your_url \
-e SUPABASE_KEY=your_key \
-e OMDB_API_KEY=your_omdb_key \
-e TMDB_API_KEY=your_tmdb_key \
python-imdb-botIf deploying with Coolify, you may encounter .env file conflicts. Here's how to fix it:
Option 1: Remove .env from repository
# Remove .env from git tracking
git rm --cached .env
# Add .env to .gitignore (if not already there)
echo ".env" >> .gitignoreOption 2: Use .env.example as template
# Copy example file
cp example.env .env
# Fill in your values
# DISCORD_TOKEN=your_token
# SUPABASE_URL=your_url
# etc.Option 3: Configure environment variables in Coolify dashboard
- Go to your Coolify application settings
- Set environment variables directly in the UI instead of using .env file
- Remove the .env file from your repository
Coolify Environment Variables to Set:
DISCORD_TOKENSUPABASE_URLSUPABASE_KEYOMDB_API_KEYTMDB_API_KEY(optional, for trailers)CHANNEL_ID
The bot requires the following environment variables:
| Variable | Required | Description |
|---|---|---|
DISCORD_TOKEN |
✅ | Discord bot token from Developer Portal |
SUPABASE_URL |
✅ | Supabase project URL |
SUPABASE_KEY |
✅ | Supabase anon/public key |
OMDB_API_KEY |
❌ | OMDB API key for movie data |
TMDB_API_KEY |
❌ | TMDB API key for trailers |
CHANNEL_ID |
❌ | Default Discord channel ID |
LOG_LEVEL |
❌ | Logging level (INFO, DEBUG, etc.) |
SENTRY_DSN |
❌ | Sentry DSN for error monitoring |
# Discord Bot Configuration
DISCORD_TOKEN=your_discord_bot_token_here
# Supabase Database Configuration
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_KEY=your_supabase_anon_key_here
# Movie Database APIs
OMDB_API_KEY=your_omdb_api_key_here
TMDB_API_KEY=your_tmdb_api_key_here
# Bot Configuration
CHANNEL_ID=your_default_channel_id_here
LOG_LEVEL=INFO
# Optional: Error monitoring
SENTRY_DSN=your_sentry_dsn_here- Invite the bot to your Discord server with the required permissions
- Set a channel for movie discussions using
/setchannel - Post IMDB links and the bot will automatically respond with movie details
- Rate movies using emoji reactions (1️⃣-9️⃣, 🔟 for 10)
/setchannel- Configure the channel for movie detection/ping- Check bot latency/echo- Echo a message (for testing)
Users can rate movies by reacting with number emojis:
- 1️⃣ = 1 star
- 2️⃣ = 2 stars
- ...
- 9️⃣ = 9 stars
- 🔟 = 10 stars
Each user can only rate each movie once, and ratings update the community average in real-time.
We welcome contributions! Please see our Contributing Guide for detailed information on:
- Setting up a development environment
- Code style and standards
- Testing guidelines
- Submitting pull requests
- Issue reporting
- API Reference - Health check endpoints documentation
- Deployment Guide - Production deployment instructions
- Coolify Optimization - Coolify-specific deployment guide
- Rating System Integration - Technical details of the rating system
- Troubleshooting - Common issues and solutions
- Changelog - Version history and changes
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ using Discord.py, Supabase, and modern Python practices.