# murolando/autoavitobot architecture

> Architecture diagram of the GitHub repository murolando/autoavitobot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/murolando/autoavitobot
- Repository: https://github.com/murolando/autoavitobot

## Overview

AutoAvitoBot is a Telegram bot for saving car-search subscriptions and finding matching Avito listings. Users start the bot, can view help and their subscriptions, create or remove subscriptions, then request matching listings with /avito. The main internal layers are command/callback handlers, subscription keyboards and callback data, and SQLite persistence; the Avito handler fetches and filters listings before replying. README documents the Avito capability and commands. The empty Drom handler is not represented as a working integration; unsampled handler behavior is not inferred.

Main entry points: [`bot.py`](https://github.com/murolando/autoavitobot/blob/main/bot.py) (Bot dispatcher), [`db.py`](https://github.com/murolando/autoavitobot/blob/main/db.py) (SQLite subscription store), [`app/handlers/show_follows.py`](https://github.com/murolando/autoavitobot/blob/main/app/handlers/show_follows.py) (List subscriptions), [`app/handlers/new_follow.py`](https://github.com/murolando/autoavitobot/blob/main/app/handlers/new_follow.py) (Create subscription)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Bot startup"]
  node_bot["Bot dispatcher<br/>[bot.py]"]
  node_start["Start command<br/>[start.py]"]
  node_info["Help command<br/>[info.py]"]
end

subgraph group_subscriptions["Subscription management"]
  node_show["List subscriptions<br/>[show_follows.py]"]
  node_create["Create subscription<br/>[new_follow.py]"]
  node_remove["Remove subscription<br/>[unfollow.py]"]
  node_stop["Stop command<br/>[stop.py]"]
  node_keyboard["Subscription keyboards"]
  node_callbacks["Callback data<br/>[callback_datas.py]"]
end

subgraph group_listing["Listing search"]
  node_avito["Avito search and filtering<br/>[avito.py]"]
  node_avito_site["Avito listings"]
end

subgraph group_persistence["Configuration and storage"]
  node_config["Token configuration<br/>[config.py]"]
  node_db[("SQLite subscription store<br/>[db.py]")]
end

node_user(("Telegram user"))
node_telegram["Telegram API"]

node_user -->|"sends commands"| node_bot
node_bot -->|"loads token"| node_config
node_bot -->|"registers handler"| node_start
node_bot -->|"registers handler"| node_info
node_bot -->|"registers handler"| node_show
node_bot -->|"registers handler"| node_create
node_bot -->|"registers handler"| node_remove
node_bot -->|"registers handler"| node_stop
node_bot -->|"registers handler"| node_avito
node_start -->|"checks and adds user"| node_db
node_show -->|"reads subscriptions"| node_db
node_show -->|"builds reply buttons"| node_keyboard
node_create -->|"requests choice buttons"| node_keyboard
node_create -->|"checks and saves"| node_db
node_keyboard -->|"loads marks and prices"| node_db
node_keyboard -->|"encodes button actions"| node_callbacks
node_remove -->|"checks and deletes"| node_db
node_avito -->|"reads subscriptions"| node_db
node_avito -->|"fetches listings"| node_avito_site
node_start -->|"sends welcome"| node_telegram
node_info -->|"sends help"| node_telegram
node_show -->|"sends subscription list"| node_telegram
node_create -->|"sends prompts"| node_telegram
node_remove -->|"sends status"| node_telegram
node_avito -->|"sends matching ads"| node_telegram

click node_bot "https://github.com/murolando/autoavitobot/blob/main/bot.py"
click node_config "https://github.com/murolando/autoavitobot/blob/main/app/config.py"
click node_start "https://github.com/murolando/autoavitobot/blob/main/app/handlers/start.py"
click node_info "https://github.com/murolando/autoavitobot/blob/main/app/handlers/info.py"
click node_show "https://github.com/murolando/autoavitobot/blob/main/app/handlers/show_follows.py"
click node_create "https://github.com/murolando/autoavitobot/blob/main/app/handlers/new_follow.py"
click node_remove "https://github.com/murolando/autoavitobot/blob/main/app/handlers/unfollow.py"
click node_stop "https://github.com/murolando/autoavitobot/blob/main/app/handlers/stop.py"
click node_keyboard "https://github.com/murolando/autoavitobot/blob/main/app/keyboards/new_follow_buttons.py"
click node_callbacks "https://github.com/murolando/autoavitobot/blob/main/app/keyboards/callback_datas.py"
click node_avito "https://github.com/murolando/autoavitobot/blob/main/app/handlers/avito.py"
click node_db "https://github.com/murolando/autoavitobot/blob/main/db.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bot,node_start,node_info,node_user toneBlue
class node_show,node_create,node_remove,node_stop,node_keyboard,node_callbacks toneAmber
class node_avito,node_avito_site,node_telegram toneMint
class node_config,node_db toneRose
```

## Components

### Bot startup

- [Bot dispatcher](https://github.com/murolando/autoavitobot/blob/main/bot.py): `bot.py`
- [Start command](https://github.com/murolando/autoavitobot/blob/main/app/handlers/start.py): `app/handlers/start.py`
- [Help command](https://github.com/murolando/autoavitobot/blob/main/app/handlers/info.py): `app/handlers/info.py`

### Subscription management

- [List subscriptions](https://github.com/murolando/autoavitobot/blob/main/app/handlers/show_follows.py): `app/handlers/show_follows.py`
- [Create subscription](https://github.com/murolando/autoavitobot/blob/main/app/handlers/new_follow.py): `app/handlers/new_follow.py`
- [Remove subscription](https://github.com/murolando/autoavitobot/blob/main/app/handlers/unfollow.py): `app/handlers/unfollow.py`
- [Stop command](https://github.com/murolando/autoavitobot/blob/main/app/handlers/stop.py): `app/handlers/stop.py`
- [Subscription keyboards](https://github.com/murolando/autoavitobot/blob/main/app/keyboards/new_follow_buttons.py): `app/keyboards/new_follow_buttons.py`
- [Callback data](https://github.com/murolando/autoavitobot/blob/main/app/keyboards/callback_datas.py): `app/keyboards/callback_datas.py`

### Listing search

- [Avito search and filtering](https://github.com/murolando/autoavitobot/blob/main/app/handlers/avito.py): `app/handlers/avito.py`
- **Avito listings**

### Configuration and storage

- [Token configuration](https://github.com/murolando/autoavitobot/blob/main/app/config.py): `app/config.py`
- [SQLite subscription store](https://github.com/murolando/autoavitobot/blob/main/db.py): `db.py`

### Other components

- **Telegram user**
- **Telegram API**

## Connections

- Telegram user → Bot dispatcher: sends commands (evidence: `README.md`)
- Bot dispatcher → Token configuration: loads token (evidence: `bot.py`)
- Bot dispatcher → Start command: registers handler (evidence: `bot.py`)
- Bot dispatcher → Help command: registers handler (evidence: `bot.py`)
- Bot dispatcher → List subscriptions: registers handler (evidence: `bot.py`)
- Bot dispatcher → Create subscription: registers handler (evidence: `bot.py`)
- Bot dispatcher → Remove subscription: registers handler (evidence: `bot.py`)
- Bot dispatcher → Stop command: registers handler (evidence: `bot.py`)
- Bot dispatcher → Avito search and filtering: registers handler (evidence: `bot.py`)
- Start command → SQLite subscription store: checks and adds user (evidence: `app/handlers/start.py`)
- List subscriptions → SQLite subscription store: reads subscriptions (evidence: `app/handlers/show_follows.py`)
- List subscriptions → Subscription keyboards: builds reply buttons (evidence: `app/handlers/show_follows.py`)
- Create subscription → Subscription keyboards: requests choice buttons (evidence: `app/handlers/new_follow.py`)
- Create subscription → SQLite subscription store: checks and saves (evidence: `app/handlers/new_follow.py`)
- Subscription keyboards → SQLite subscription store: loads marks and prices (evidence: `app/keyboards/new_follow_buttons.py`)
- Subscription keyboards → Callback data: encodes button actions (evidence: `app/keyboards/new_follow_buttons.py`)
- Remove subscription → SQLite subscription store: checks and deletes (evidence: `app/handlers/unfollow.py`)
- Avito search and filtering → SQLite subscription store: reads subscriptions (evidence: `app/handlers/avito.py`)
- Avito search and filtering → Avito listings: fetches listings (evidence: `app/handlers/avito.py`)
- Start command → Telegram API: sends welcome (evidence: `app/handlers/start.py`)
- Help command → Telegram API: sends help (evidence: `app/handlers/info.py`)
- List subscriptions → Telegram API: sends subscription list (evidence: `app/handlers/show_follows.py`)
- Create subscription → Telegram API: sends prompts (evidence: `app/handlers/new_follow.py`)
- Remove subscription → Telegram API: sends status (evidence: `app/handlers/unfollow.py`)
- Avito search and filtering → Telegram API: sends matching ads (evidence: `app/handlers/avito.py`)
