Skip to content

Gishankrishka/telegram-translation-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 Telegram Translation Bot

Telegram Translation Bot Python Gemini AI

πŸš€ A powerful Telegram bot that auto-translates messages from source channels using Google's Gemini AI

License Stars Forks Issues

πŸš€ Quick Deploy β€’ πŸ“– Documentation β€’ 🀝 Contributing β€’ πŸ’¬ Support


✨ Features

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

πŸš€ Deploy Now

One-Click Deployment

Deploy

Deploy to Render

Additional Deployment Options

Vercel

Deploy with Vercel

Netlify

Deploy to Netlify


πŸ› οΈ Prerequisites

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

πŸ“‹ Setup Guide

πŸ€– Step 1: Create Telegram Bot

  1. Open @BotFather on Telegram
  2. Send /newbot and follow the prompts
  3. Choose a unique name and username for your bot
  4. πŸ“ Copy the Bot Token (format: 123456789:ABCDEF...)
BotFather

πŸ” Step 2: Get Telegram API Credentials

  1. Visit my.telegram.org
  2. Log in with your phone number
  3. Click API Development Tools
  4. Fill in the application details
  5. πŸ“ Note your API_ID and API_HASH

πŸ“’ Step 3: Configure Destination Chat

  1. Add your bot as an administrator to the source chat
  2. Give it permission to read messages
  3. add @MissRose_bot to the chat and send /id
  4. πŸ“ Copy the Channel ID (format: -100xxxxxxxxxx)

🌐 Step 4: Choose Target Language

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

🧠 Step 5: Get Gemini API Key

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click Create API Key
  4. πŸ“ Copy your Gemini API key
Google AI Studio

βš™οΈ Configuration

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

πŸš€ Local Development

  1. Clone the repository

    git clone https://github.com/yourusername/telegram-translation-bot.git
    cd telegram-translation-bot
  2. Install dependencies

    pip install -r requirements.txt
  3. Configure your settings

    cp .env.example. .env
    # Edit .env with your credentials
  4. Run the bot

    python3 -m Bot

🌟 Features in Detail

πŸ”„ Real-time Translation

The bot monitors your source channel 24/7 and instantly translates new messages using Google's Gemini AI, ensuring you never miss important updates.

🎯 Smart Context Understanding

Gemini AI doesn't just translate wordsβ€”it understands context, idioms, and cultural nuances for more accurate translations.

πŸ›‘οΈ Error Handling

Built-in retry mechanisms and error handling ensure your bot stays online even during network issues or API rate limits.

πŸ“Š Performance Monitoring

Optional logging and monitoring features to track translation accuracy and bot performance.


🀝 Contributing

We welcome contributions from the community! Here's how you can help:

Contributors Good First Issues

πŸ› Report Bugs

Found a bug? Open an issue with detailed information.

πŸ’‘ Suggest Features

Have an idea? Open a feature request and let's discuss it!

πŸ”§ Submit Pull Requests

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ‘₯ Contributors

Thanks to all the amazing people who have contributed to this project:

Contributors

Made with contributors-img.


πŸ“„ License

License: MIT

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ’¬ Support

Need help? We're here for you!

Telegram Support Discord GitHub Issues

πŸ†˜ Common Issues

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

🌟 Star History

Star History Chart


πŸš€ What's Next?

  • 🎨 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

⭐ Star this repo if you found it helpful! ⭐

GitHub stars GitHub forks

Made with ❀️ by Gishan Krishka

About

translate telegram channels incoming messages with google genai

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published