Skip to content

tr3bleee/AIAssistantBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

43 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AI Assistant Bot v2.0 ๐Ÿค–

A powerful Telegram bot that combines multiple AI models to provide intelligent conversations, code assistance, and image generation.

Features โœจ

Multiple AI Models

  • GPT-4 ๐Ÿค– - Advanced language model from OpenAI
  • Gemini โœจ - Google's latest AI model
  • GPT-4O ๐Ÿ”ฎ - Optimized GPT-4 version
  • GPT-4O-mini ๐ŸŽฏ - Faster, lighter version
  • Claude 3.5 Sonnet ๐ŸŽญ - Anthropic's latest model
  • Claude 3.5 Haiku ๐ŸŽ‹ - Fast and efficient version

Core Features

  • Multi-language support (English ๐Ÿ‡ฌ๐Ÿ‡ง, Russian ๐Ÿ‡ท๐Ÿ‡บ, Ukrainian ๐Ÿ‡บ๐Ÿ‡ฆ)
  • Code block formatting with syntax highlighting
  • Image generation capabilities
  • Smart conversations with context awareness
  • User preferences persistence
  • Chat statistics tracking

Setup ๐Ÿ› ๏ธ

Prerequisites

  • Python 3.8 or higher
  • Telegram Bot Token
  • API keys for AI services:
    • OpenAI API key
    • Google Gemini API key
    • Anthropic API key

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/ai-assistant-bot.git cd ai-assistant-bot
  1. Install dependencies:
pip install -r requirements.txt
  1. Create .env file with your API keys:
BOT_TOKEN=your_telegram_bot_token OPENAI_API_KEY=your_openai_api_key GEMINI_API_KEY=your_gemini_api_key ANTHROPIC_API_KEY=your_anthropic_api_key
  1. Run the bot:
python main.py

Usage ๐Ÿ’ก

Available Commands

  • /start - Initialize the bot
  • /help - Show available commands
  • /model - Change AI model
  • /language - Change interface language
  • /newtopic - Start new conversation
  • /image - Generate images
  • /stats - Show chat statistics
  • /about - About the bot

Quick Access Buttons

  • โ“ Help
  • ๐Ÿ”„ Change Model
  • ๐ŸŒ Language
  • โ„น๏ธ About
  • ๐Ÿ†• New Topic
  • ๐ŸŽจ Generate Image

Code Formatting

The bot supports code blocks with syntax highlighting for multiple languages:

  • Python
  • C++
  • JavaScript
  • HTML/CSS
  • Java
  • Rust
  • Go
  • And more...

Example: ```python def hello_world(): print("Hello, World!") ```

Image Generation

Use the /image command followed by your description to generate images:

/image A futuristic city at night with neon lights 

Features in Detail ๐Ÿ“

AI Models

  • GPT-4: Best for complex tasks and detailed explanations
  • Gemini: Excellent for general-purpose conversations
  • GPT-4O: Optimized for better performance
  • GPT-4O-mini: Fast responses for simple queries
  • Claude Sonnet: Advanced reasoning and analysis
  • Claude Haiku: Quick and efficient responses

Language Support

  • ๐Ÿ‡ฌ๐Ÿ‡ง English: Full support with all features
  • ๐Ÿ‡ท๐Ÿ‡บ Russian: Complete localization
  • ๐Ÿ‡บ๐Ÿ‡ฆ Ukrainian: Full interface translation

Message Handling

  • Smart message chunking for long responses
  • Code block preservation
  • Inline code formatting
  • Anti-flood protection
  • Error handling and retries

User Experience

  • Persistent user preferences
  • Chat history management
  • Response time tracking
  • Usage statistics
  • Model-specific optimizations

Technical Details ๐Ÿ”ง

Architecture

  • Built with aiogram 3.15.0
  • Asynchronous design
  • Modular service structure
  • State management system
  • Message queue implementation

Storage

  • User preferences persistence
  • Chat history management
  • Statistics tracking
  • Model usage metrics

Security

  • API key protection
  • Content safety checks
  • Error message sanitization
  • Rate limiting

Contributing ๐Ÿค

Contributions are welcome! Please feel free to submit a Pull Request.

License ๐Ÿ“„

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

Support ๐Ÿ’ฌ

If you have any questions or need help, feel free to:

Acknowledgments ๐Ÿ™

  • OpenAI for GPT-4
  • Google for Gemini
  • Anthropic for Claude
  • The aiogram community