Back to projects

Case Study

Dekrov AI Userbot

A Telegram-first AI system that works from the owner's own account, adds a dedicated control bot, supports an optional public chat bot, and keeps memory, reminders, live data, and automation inside one flow.

Completed successfully Python + Pyrogram Groq + Live Data Userbot + Control Bot

Open Source

Open repository

Full source code, setup details, and documentation are available on GitHub.

Problem

Most Telegram AI projects are thin wrappers around a single model call. They can answer messages, but they do not behave like a real operating layer for an account: weak memory, no action routing, limited control, and too much friction between chat, tools, and automation.

Solution

The project combines a Pyrogram userbot, a separate control bot, an optional public chat bot, layered memory, reminder scheduling, live-data tools, and structured Telegram action routing. The result is a compact but capable AI operating system built directly around Telegram.

3 command modes Dialogue, Telegram actions, and AI tasks are split into dedicated command channels.
No database Runtime state is stored in local JSON files and Telegram session files for portability.
Telegram-native No separate frontend is required for the owner to manage reminders, replies, and actions.
Model fallback AI models can be switched or backed off when limits, failures, or edge cases appear.

Architecture

Userbot Core

The main engine runs from the owner's Telegram account via Pyrogram and handles direct commands, chat context, auto-replies, reminders, and action execution.

Control Bot

A separate Telegram bot provides a control layer for runtime settings, response modes, allow/block lists, fallback behavior, and feature toggles.

Optional Chat Bot

When enabled, a public-facing bot exposes the AI to normal chat users without replacing the owner-centric userbot flow.

The project avoids a classic web stack and keeps the interaction loop inside Telegram. Instead of browser forms and dashboards, the system routes natural language into concrete actions, memory updates, and live requests.

Owner Message -> Intent / Command Router -> AI / Action / Live Tool -> Telegram Response

Interaction Modes

.d

Dialogue and owner workflow mode. It handles planning, reminders, memory updates, directives, everyday assistance, and longer-form requests.

  • Owner-oriented assistant behavior
  • Reminder creation and review
  • Style and directive updates
.k

Structured Telegram action mode. This is where the system turns natural language into concrete chat operations: forward, delete, archive, inspect, and move content between chats.

  • Natural-language Telegram control
  • Cross-chat actions and utilities
  • Execution policies and confirmations
.b

AI task mode for summarization, search, live information, image reasoning, and voice transcription through Groq-backed services.

  • Voice-to-text with Whisper
  • Vision analysis for images
  • Search, news, rates, and weather

Memory and Personalization

Layered Memory

The system stores owner profile data, user-specific memory, entity facts, shared short-term context, and style signals. This creates continuity between chats without turning the project into a heavyweight platform.

Adaptive Style

Style weighting lets the assistant balance the owner's voice, the target user's tone, and current chat context. That makes replies feel less generic and much more aligned with how the owner actually communicates.

  • Owner knowledge is stored separately and can be rewritten without touching code.
  • Per-user profiles and entity memory accumulate context over time.
  • Reminder and scheduler state survives restarts.
  • JSON persistence keeps deployment simple and transparent.

Live Tools and Retrieval

Web Grounding

Search routing combines DuckDuckGo, Google, Wikipedia, GitHub search, and optional SearXNG, then extracts article content for better grounded answers.

Daily Utilities

Weather, exchange rates, news, and general live requests are treated as first-class tools, not as afterthoughts glued onto a chat bot.

Multimodal Input

Voice transcription and image analysis expand the assistant beyond plain text and make it useful in actual Telegram usage patterns.

Operations and Constraints

Configuration

The project is driven by `.env`, session files, JSON state, and owner knowledge content. That keeps setup explicit: Telegram credentials, Groq API key, command behavior, search toggles, and memory options.

Safety

The design includes outgoing-only command restrictions, identity limits, validation, silence logic, and safety filters so automation stays useful without turning reckless.

  • No SQL database, Redis, or Docker is required for the core workflow.
  • Pyrogram session files are sensitive and must remain private.
  • The system is designed to run as a persistent Python process on a local machine or VPS.
  • The control bot is operationally important because it exposes runtime management without a web admin.

Technology Stack

Result

Dekrov AI Userbot stands out because it treats Telegram as the primary product surface, not as a thin integration. It combines assistant behavior, structured actions, memory, reminders, live retrieval, and model management into one coherent toolchain. As a portfolio case, it shows strong systems thinking: the project is opinionated, modular, practical, and clearly built around real usage instead of demo-only AI features.