This bot monitors your specified Twitch streamer and sends notifications to your Telegram when they go live.
- Instant notifications when streamer goes live
- Stream title and game information
- Direct link to stream
- Checks every 2 minutes
- Spam protection (no duplicate notifications for same stream)
- Automatic reconnection
- Error recovery
- Python 3.x
- pip (Python package manager)
- Twitch Developer account
- Telegram bot
-
Clone the repository:
git clone [repo-url] cd twitch-telegram-bot
-
Create virtual environment:
python -m venv venv source venv/bin/activate # For Linux/Mac # or .\venv\Scripts\activate # For Windows
-
Install requirements:
pip install -r requirements.txt
-
Get API credentials:
Twitch API Credentials:
- Go to Twitch Developer Console
- Create a new application
- Get your Client ID and Client Secret
Telegram Bot:
- Talk to @BotFather
- Create new bot using
/newbot
command - Get your bot token
- Send a message to your bot
- Get your chat ID by visiting:
https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
-
Create
.env
file:TWITCH_CLIENT_ID=your_twitch_client_id TWITCH_CLIENT_SECRET=your_twitch_client_secret TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id TWITCH_USERNAME=favorite_streamer_username
To start the bot:
python main.py
The bot will:
- Check streamer status every 2 minutes
- Send notification when stream starts
- Include stream title, game, and link in notification
- Avoid duplicate notifications for same stream
- Send initial notification if stream is live when bot starts
If the bot encounters errors:
- Verify credentials in
.env
file - Check your internet connection
- Verify Twitch API keys are valid
- Ensure your Telegram bot is active
- Use tools like screen or tmux to keep the bot running in background
- Notifications are sent only once when stream starts
- Bot will wait 60 seconds and retry on errors
We welcome contributions to improve this project! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
Your contributions will help make this bot even better. Thank you for your interest in the project!