Skip to content

RustamovAkrom/DeepSeek_TelegramBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DeepSeek Telegram Bot

AI-powered multi-language chatbot built with Aiogram 3, DeepSeek API, and OpenRouter.
Supports model switching, smart history, per-user configuration, and clean modular architecture.


πŸš€ Features

🧠 AI Chat Powered by DeepSeek

  • Supports multiple DeepSeek models
  • Each user can select their own model
  • Smart chat history with automatic trimming
  • Configurable system prompt
  • Fast async requests through OpenRouter

πŸ‘€ Per-user Settings

  • Selected model
  • Language
  • Custom API key (optional)
  • All saved in meta-JSON in DB

πŸ—‚ Powerful Architecture

  • Clean project structure
  • Modular handlers
  • CRUD layer for DB operations
  • Service layer for business logic
  • SQLAlchemy + Async engine

πŸ“ Project Structure


app/
β”œβ”€ handlers/
β”‚   β”œβ”€ help.py
β”‚   β”œβ”€ models.py
β”‚   β”œβ”€ language_change.py
β”‚   └─ chat.py
β”œβ”€ services/
β”‚   β”œβ”€ ai_service.py
β”‚   └─ user_service.py
β”œβ”€ crud/
β”‚   β”œβ”€ users.py
β”‚   └─ history.py
β”œβ”€ models/
β”‚   β”œβ”€ users.py
β”‚   └─ ai_history.py
β”œβ”€ db/
β”‚   β”œβ”€ base.py
β”‚   └─ session.py
β”œβ”€ run.py
└─ config.py


βš™οΈ Installation

1️⃣ Clone project

git clone https://github.com/RustamovAkrom/DeepSeek_TelegramBot.git
cd DeepSeek_TelegramBot

2️⃣ Create virtual environment

python -m venv .venv
source .venv/bin/activate   # Linux / Mac
.venv\Scripts\activate      # Windows

3️⃣ Install dependencies

pip install -r requirements.txt

4️⃣ Create .env

You can get your api keys from this resources and set into .env file:

DEEPSEEK_API_KEY=DEEPSEEK_API_KEY 
TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN
ADMIN_IDS=6572863564
ENV=dev # dev or prod
DATABASE_URL=DATABASE_URL # production database 
TEST_DATABASE_URL=sqlite+aiosqlite:///./test.db # development database and for testing

▢️ Run bot

python run.py

🧩 Main Commands

Command Description
/start Start bot and init user
/help Show help message
/models Choose AI model
/admin Manage users
/models Change model DeepSeek
/profile User profile
text Simply chat with the AI


🀝 Contributing

Pull requests and improvements are welcome! Feel free to open issues or suggest features.


⭐️ Support

If this bot helped you β€” leave a star ⭐️ in the repository! Your support motivates me to continue improving it πŸ’™


πŸ“œ License

MIT β€” free for personal and commercial use.

About

βœ… completed | Telegram Bot with integration DeepSeek models in Aiogram 🌐🧠

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published