Skip to content

MilesONerd/telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MilesONerd AI Telegram Bot

An intelligent Telegram bot powered by advanced AI models and internet search capabilities. The bot uses Llama 3.1-Nemotron for text generation and BART for text summarization, with future plans for internet search integration.

Features

  • Advanced language understanding using multiple AI models
  • Text summarization for long messages
  • Intelligent response generation
  • Continuous learning capabilities (planned)
  • Internet search integration (planned)

Requirements

  • Python 3.8+
  • pip (Python package manager)
  • A Telegram Bot Token (get it from @BotFather)

Installation

  1. Clone the repository:
git clone https://github.com/MilesONerd/telegram-bot.git
cd telegram-bot
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env

Edit .env and set your Telegram Bot Token:

TELEGRAM_BOT_TOKEN=your_bot_token_here

Usage

  1. Start the bot:
python bot.py
  1. Open Telegram and search for your bot using the username you set with @BotFather

  2. Start chatting with the bot using these commands:

  • /start - Begin interaction with the bot
  • /help - Show available commands
  • /about - Learn more about the bot

Message Handling

The bot processes messages differently based on their content:

  • Short questions (< 10 words): Quick responses using Llama 3.3
  • Long messages (> 100 words): Summarization using BART + detailed response
  • Messages containing 'summarize' or 'tldr': Text summarization
  • Chat-related queries: Optimized conversation handling
  • Regular messages: Comprehensive AI-powered responses

Environment Variables

  • TELEGRAM_BOT_TOKEN: Your Telegram Bot API token (required)
  • SERPAPI_API_KEY: Google Search API key (optional, for future use)
  • DEFAULT_MODEL: Default AI model to use (default: llama)
  • ENABLE_CONTINUOUS_LEARNING: Enable/disable learning capabilities (default: true)

Project Structure

telegram-bot/
├── bot.py              # Main bot implementation
├── ai_handler.py       # AI model handling and text generation
├── requirements.txt    # Python dependencies
├── .env.example        # Environment variables template
├── README.md          # Project documentation
└── LICENSE            # Project License

Development Status

  • Basic bot implementation
  • Llama 3.1-Nemotron integration
  • BART integration
  • Llama 3.3 integration
  • Mistral Mathstral
  • Mistral Mamba Codestral
  • Mistral Pixtral
  • Internet search integration
  • Continuous learning implementation
  • Advanced error handling
  • Performance optimizations

License

This project is BSD 3-Clause License. All rights reserved to Enzo Fuke (MilesONerd).

Author

Created by MilesONerd