SkillAgentSearch skills...

AdvAITelegramBot

Telegram Advanced AI Bot (50k+ lifetime users ) : GPT-5, Qwen-3, DeepSeek-R1, Dall-E-3, Flux, Flux-Pro, Dall-E Model, OCR and Google Voice2Text.

Install / Use

/learn @TechyCSR/AdvAITelegramBot

README

Advanced AI Telegram Bot

<div align="center">

Python Telegram MongoDB License g4f

A next-generation AI-powered Telegram bot with intelligent vision, image editing, and multi-provider architecture.

Try the Bot · Report Bug · Request Feature

</div> <div align="center"> <a href="https://t.me/AdvChatGptbot" alt="Run Telegram Bot"> <img src="https://img.shields.io/badge/RUN-Telegram%20Bot-blue?logo=data:image/svg+xml;base64,PHN2ZyBpZD0iTGl2ZWxsb18xIiBkYXRhLW5hbWU9IkxpdmVsbG8gMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDI0MCAyNDAiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iMTIwIiB5MT0iMjQwIiB4Mj0iMTIwIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMWQ5M2QyIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjMzhiMGUzIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHRpdGxlPlRlbGVncmFtX2xvZ288L3RpdGxlPjxjaXJjbGUgY3g9IjEyMCIgY3k9IjEyMCIgcj0iMTIwIiBmaWxsPSJ1cmwoI2xpbmVhci1ncmFkaWVudCkiLz48cGF0aCBkPSJNODEuMjI5LDEyOC43NzJsMTQuMjM3LDM5LjQwNnMxLjc4LDMuNjg3LDMuNjg2LDMuNjg3LDMwLjI1NS0yOS40OTIsMzAuMjU1LTI5LjQ5MmwzMS41MjUtNjAuODlMODEuNzM3LDExOC42WiIgZmlsbD0iI2M4ZGFlYSIvPjxwYXRoIGQ9Ik0xMDAuMTA2LDEzOC44NzhsLTIuNzMzLDI5LjA0NnMtMS4xNDQsOC45LDcuNzU0LDAsMTcuNDE1LTE1Ljc2MywxNy40MTUtMTUuNzYzIiBmaWxsPSIjYTljNmQ4Ii8+PHBhdGggZD0iTTgxLjQ4NiwxMzAuMTc4LDUyLjIsMTIwLjYzNnMtMy41LTEuNDItMi4zNzMtNC42NGMuMjMyLS42NjQuNy0xLjIyOSwyLjEtMi4yLDYuNDg5LTQuNTIzLDEyMC4xMDYtNDUuMzYsMTIwLjEwNi00NS4zNnMzLjIwOC0xLjA4MSw1LjEtLjM2MmEyLjc2NiwyLjc2NiwwLDAsMSwxLjg4NSwyLjA1NSw5LjM1Nyw5LjM1NywwLDAsMSwuMjU0LDIuNTg1Yy0uMDA5Ljc1Mi0uMSwxLjQ0OS0uMTY5LDIuNTQyLS42OTIsMTEuMTY1LTIxLjQsOTQuNDkzLTIxLjQsOTQuNDkzcy0xLjIzOSw0Ljg3Ni01LjY3OCw1LjA0M0E4LjEzLDguMTMsMCwwLDEsMTQ2LjEsMTcyLjVjLTguNzExLTcuNDkzLTM4LjgxOS0yNy43MjctNDUuNDcyLTMyLjE3N2ExLjI3LDEuMjcsMCwwLDEtLjU0Ni0uOWMtLjA5My0uNDY5LjQxNy0xLjA1LjQxNy0xLjA1czUyLjQyNi00Ni42LDUzLjgyMS01MS40OTJjLjEwOC0uMzc5LS4zLS41NjYtLjg0OC0uNC0zLjQ4MiwxLjI4MS02My44NDQsMzkuNC03MC41MDYsNDMuNjA3QTMuMjEsMy4yMSwwLDAsMSw4MS40ODYsMTMwLjE3OFoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=" align="center" style="width: 40%" /> </a> </div>

Overview

Advanced AI Telegram Bot is a feature-rich, production-ready bot that leverages multiple AI providers to deliver intelligent conversations, image generation, vision analysis, and image editing capabilities. Built with a robust multi-provider fallback system ensuring high availability and reliability.


Key Features

AI-Powered Conversations

  • Multi-Model Support — GPT-4o, DeepSeek, Qwen, Llama, and more
  • Context-Aware Chat — Maintains conversation history for natural dialogue
  • System Prompt Versioning — Ensures all users receive the latest AI behavior updates
  • Smart Response Formatting — Proper markdown/HTML rendering with code block support

Vision & Image Intelligence

  • AI Vision Analysis — Upload any image and ask questions about it
  • Multi-Provider Vision — DeepInfra, Qwen, HuggingFace, DeepSeek Janus, Pollinations
  • Document Processing — Extract text, solve MCQs, analyze PDFs and documents
  • Follow-up Questions — Continue asking about the same image (configurable uses)

Image Generation & Editing

  • Text-to-Image — Generate images from text descriptions using /img command
  • AI-Driven Image Editing — Send an image and describe changes; AI intelligently decides whether to edit or analyze
  • Multi-Provider Image Generation — Flux, DALL-E, Pollinations with automatic fallback
  • Inline Mode — Generate images in any chat using inline queries

Voice & Speech

  • Speech-to-Text — Send voice messages for AI transcription and response
  • Text-to-Speech — Convert AI responses to voice messages
  • Multi-language Voice Support — Process voice in multiple languages

Group & Multi-Bot

  • Full Group Integration — AI works seamlessly in group chats with mentions
  • Per-Group Settings — Customize AI behavior for each group
  • Multi-Bot Architecture — Run multiple bot instances with isolated sessions
  • MongoDB Fork Safety — Each process maintains its own database connection

Administration

  • User Management — Ban, unban, premium status control
  • Broadcast System — Send announcements to all users
  • Statistics Dashboard — Track usage, active users, and performance
  • Maintenance Mode — Gracefully handle updates and downtime

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                           User Interfaces                           │
├──────────────────┬──────────────────┬───────────────────────────────┤
│  Telegram Chat   │   Inline Mode    │         Web App               │
└────────┬─────────┴────────┬─────────┴───────────────┬───────────────┘
         │                  │                         │
         └──────────────────┴─────────────────────────┘
                            │
                    ┌───────▼───────┐
                    │   Bot Core    │
                    │ Request Queue │
                    └───────┬───────┘
                            │
        ┌───────────────────┼───────────────────┐
        │                   │                   │
┌───────▼───────┐   ┌───────▼───────┐   ┌───────▼───────┐
│   Text AI     │   │   Vision AI   │   │   Image AI    │
│               │   │               │   │               │
│ • GPT-4o      │   │ • DeepInfra   │   │ • Flux        │
│ • DeepSeek    │   │ • Qwen VL     │   │ • DALL-E      │
│ • Qwen        │   │ • HuggingFace │   │ • Pollinations│
│ • Llama       │   │ • Janus Pro   │   │ • Kontext     │
└───────┬───────┘   └───────┬───────┘   └───────┬───────┘
        │                   │                   │
        └───────────────────┼───────────────────┘
                            │
                    ┌───────▼───────┐
                    │   MongoDB     │
                    │   Database    │
                    └───────────────┘

Provider Fallback System

The bot implements an intelligent multi-provider fallback mechanism:

  1. Primary Provider — First attempt with the fastest/most capable provider
  2. Secondary Providers — Automatic fallback if primary fails
  3. Error Handling — Graceful degradation with user notification
  4. Load Distribution — Prevents single-point-of-failure

Quick Start

# Clone the repository
git clone https://github.com/TechyCSR/AdvAITelegramBot.git
cd AdvAITelegramBot

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure the bot
cp config.example.py config.py
# Edit config.py with your credentials

# Run
python run.py

Configuration

Create config.py with the following structure:

# Required
BOT_TOKEN = "your_bot_token"           # From @BotFather
API_KEY = "your_api_id"                # From my.telegram.org
API_HASH = "your_api_hash"             # From my.telegram.org
DATABASE_URL = "mongodb://localhost:27017/"

# Admin Configuration
ADMINS = [123456789]                   # Telegram user IDs with admin rights

# Optional Settings
IMAGE_CONTEXT_EXPIRY_MINUTES = 2       # Auto-delete uploaded images
IMAGE_CONTEXT_MAX_USES = 5             # Follow-up questions per image
MULTI_BOT = False                      # Enable multi-bot mode
PREMIUM_MODELS = ["gpt-4o", "dall-e-3"] # Premium-only models

Commands

| Command | Description | |---------|-------------| | /start | Initialize conversation with the bot | | /help | Display available commands and usage | | /settings | Configure language, model, and preferences | | /img [prompt] | Generate an image from text description | | /newchat | Clear conversation history and start fresh | | /endimage | Clear current image context | | /model | Select AI model for conversations |

Image & Vision Usage

Vision Analysis:

  1. Send any image to the bot
  2. Add a caption with your question, or send without caption for general analysis
  3. Use follow-up messages to ask more questions about the same image

Image Editing:

  1. Send an image to the bot
  2. Describe the changes you want (e.g., "make the sky more blue", "add a sunset")
  3. AI automatically detects if you want editing or analysis and responds accordingly

Technology Stack

| Component | Technology | |-----------|------------| | Framework | Pyrogram (async Telegram client) | | Database | MongoDB | | AI Providers | g4f (GPT4Free), OpenAI, DeepInfra, HuggingFace | | Image Generation | Flux, DALL-E, Pollinations, BlackForestLabs | | Vision Models | Llama Vision, Qwen VL, Janus Pro | | Deployment | Docker, systemd |


Project Structure

AdvAITelegramBot/
├── run.py                 # Application entry point
├── config.py              # Configuration settings
├── modules/
│   ├── models/            # AI response handlers
│   │   ├── ai_res.py      # Main AI response logic
│   │   └── multi_provider_text.py
│   ├── image/             # Image processing
│   │   ├── img_to_text.py # Vision & image editing
│   │   └── image_generation.py
│   ├── speech/            # Voice processing
│   ├── user/              # User commands
│   ├── admin/
View on GitHub
GitHub Stars16
CategoryCustomer
Updated19d ago
Forks2

Languages

Python

Security Score

80/100

Audited on Mar 13, 2026

No findings