A Telegram bot for tracking TV series, managing watchlists, and receiving notifications about new episodes.
- Add TV series to your watch list
- Update seasons/episodes you've watched
- Get notifications for new episode/season releases
- List all series you're currently watching
- Remove series from your list
- Clone this repository
- Create a virtual environment:
python -m venv venv - Activate the virtual environment:
- Windows:
venv\Scripts\activate - macOS/Linux:
source venv/bin/activate
- Windows:
- Install dependencies:
pip install -r requirements.txt - Edit the
.envfile and add your TMDB API key - Run the bot:
./venv/bin/python run.py
/start- Start the bot/help- Show available commands/add- Add a new TV series/list- List all TV series you're watching/update- Update your progress on a series/remove- Remove a series from your list
You need to obtain a TMDB API key from https://www.themoviedb.org/ and set it in the .env file.
Also, make sure your Telegram bot token is correct in the .env file.
docker logs -f serials-bot
docker restart serials-bot
git pull docker build -t serials-bot . docker stop serials-bot docker rm serials-bot docker run -d --name serials-bot --restart unless-stopped -p 8443:8443 --env-file .env serials-bot
- Install PostgreSQL if you haven't already:
# For macOS
brew install postgresql
# For Ubuntu/Debian
sudo apt-get install postgresql postgresql-contrib- Create a new database:
# Connect to PostgreSQL
psql postgres
# Create database
CREATE DATABASE serials_bot;
# Create user (optional)
CREATE USER your_username WITH PASSWORD 'your_password';
# Grant privileges
GRANT ALL PRIVILEGES ON DATABASE serials_bot TO your_username;
# Exit psql
\q- Set up environment variables in
.env:
# PostgreSQL Configuration
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=serials_bot
- Initialize the database tables:
# Run the test connection script to create tables
python test_db_connection.pyThe bot uses the following tables:
-
users- Stores user information:id(Primary Key)telegram_id(Unique)usernamefirst_namelast_namejoined_date
-
series- Stores TV series information:id(Primary Key)tmdb_id(Unique)nameyeartotal_seasonslast_update
-
user_series- Links users with their series:id(Primary Key)user_id(Foreign Key)series_id(Foreign Key)current_seasoncurrent_episodeis_watchingin_watchlistis_watchedwatched_datelast_updated
If you're migrating from SQLite to PostgreSQL:
-
Make sure your PostgreSQL database is set up and configured in
.env -
Run the migration script:
python migrate_db.pyThe script will:
- Read data from your SQLite database
- Create tables in PostgreSQL
- Migrate all users, series, and user series relationships
- Handle any errors during migration
- Set environment variables:
ENVIRONMENT=development
TELEGRAM_BOT_TOKEN=your_bot_token
TMDB_API_KEY=your_tmdb_api_key
- Run the bot:
python -m bot.main- Set environment variables in Render:
ENVIRONMENT=production
TELEGRAM_BOT_TOKEN=your_bot_token
TMDB_API_KEY=your_tmdb_api_key
WEBHOOK_URL=https://your-render-service-url.onrender.com
POSTGRES_USER=your_render_db_user
POSTGRES_PASSWORD=your_render_db_password
POSTGRES_HOST=your_render_db_host
POSTGRES_PORT=5432
POSTGRES_DB=your_render_db_name
- Deploy to Render:
- Connect your repository
- Set build command:
pip install -r requirements.txt - Set start command:
python -m bot.main
/start- Start the bot/help- Show help message/add- Add a new TV series to your watchlist/list- List all TV series you are watching/update- Update your progress on a series/remove- Remove a series from your watchlist/watchlist- View your future watchlist/addwatch- Add a series to your future watchlist/watched- List all watched series/addwatched- Add a new watched series