π A powerful Telegram bot that auto-translates messages from source channels using Google's Gemini AI
π Quick Deploy β’ π Documentation β’ π€ Contributing β’ π¬ Support
| Feature | Description |
|---|---|
| π Real-time Translation | Automatically translates messages as they arrive |
| π€ Gemini AI Powered | Uses Google's advanced AI for accurate translations |
| π Multi-language Support | Supports 100+ languages with ISO codes |
| β‘ Cloud Deployment | Easy deployment on Railway, Heroku, or any VPS |
| π Secure & Private | Your credentials stay safe with you |
| π± Friendly | Works seamlessly on all Telegram clients |
Before getting started, make sure you have:
- π Python 3.7+ installed
- π± Telegram account
- π Google account for Gemini API access
- βοΈ Cloud platform account (Railway/Heroku/Render) for deployment
- Open @BotFather on Telegram
- Send
/newbotand follow the prompts - Choose a unique name and username for your bot
- π Copy the Bot Token (format:
123456789:ABCDEF...)
- Visit my.telegram.org
- Log in with your phone number
- Click API Development Tools
- Fill in the application details
- π Note your
API_IDandAPI_HASH
- Add your bot as an administrator to the source chat
- Give it permission to read messages
- add @MissRose_bot to the chat and send /id
- π Copy the Channel ID (format:
-100xxxxxxxxxx)
Select your preferred language using ISO 639-1 codes:
| Language | Code | Language | Code |
|---|---|---|---|
| English | en |
Spanish | es |
| French | fr |
German | de |
| Sinhala | si |
Tamil | ta |
| Hindi | hi |
Arabic | ar |
- Visit Google AI Studio
- Sign in with your Google account
- Click Create API Key
- π Copy your Gemini API key
Create a config.py file in your project root:
class Config:
# Telegram Bot Configuration
BOT_TOKEN = "YOUR_BOT_TOKEN_HERE"
API_ID = "YOUR_API_ID_HERE"
API_HASH = "YOUR_API_HASH_HERE"
# Channel Configuration
SOURCE_CHANNEL = -1001234567890 # Your destination channel ID
# Translation Configuration
LANGUAGE_CODE = "en" # Target language (ISO 639-1)
# AI Configuration
GEMINI_API_KEY = "YOUR_GEMINI_API_KEY_HERE"
# Optional: Advanced Settings
MAX_MESSAGE_LENGTH = 4096
TRANSLATION_TIMEOUT = 30
RATE_LIMIT_DELAY = 1-
Clone the repository
git clone https://github.com/yourusername/telegram-translation-bot.git cd telegram-translation-bot -
Install dependencies
pip install -r requirements.txt
-
Configure your settings
cp .env.example. .env # Edit .env with your credentials -
Run the bot
python3 -m Bot
The bot monitors your source channel 24/7 and instantly translates new messages using Google's Gemini AI, ensuring you never miss important updates.
Gemini AI doesn't just translate wordsβit understands context, idioms, and cultural nuances for more accurate translations.
Built-in retry mechanisms and error handling ensure your bot stays online even during network issues or API rate limits.
Optional logging and monitoring features to track translation accuracy and bot performance.
We welcome contributions from the community! Here's how you can help:
Found a bug? Open an issue with detailed information.
Have an idea? Open a feature request and let's discuss it!
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
| Issue | Solution |
|---|---|
| Bot not responding | Check if bot token is correct and bot is added to channel |
| Translation errors | Verify Gemini API key and check rate limits |
| Channel ID issues | Ensure channel ID format is correct (-100xxxxxxxxxx) |
| Deployment failures | Check all environment variables are set correctly |
- π¨ Web dashboard for bot management
- π Translation analytics and statistics
- π Support for multiple source channels
- π― Custom translation prompts
- π± Mobile app companion
- π Support for more AI providers