# thealoneteam/meowrobot architecture

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

- Interactive diagram: https://gitdiagram.com/thealoneteam/meowrobot
- Repository: https://github.com/thealoneteam/meowrobot

## Overview

MeowRoBot is a modular Telegram group-management bot with AI chat, moderation, group controls, and community features. Telegram users interact with the running bot; feature modules handle commands and events, with SQL-backed settings supporting capabilities such as locks, welcomes, and user records. The README also describes notes, custom filters, night mode, and chatbot integration, whose source was not sampled. Edges are limited to relationships visible in excerpts, the source index, or documented by the README; unsampled feature wiring is not inferred.

Main entry points: [`MeowRobot/modules/sql/__init__.py`](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/__init__.py) (SQL sessions), [`MeowRobot/__main__.py`](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/__main__.py) (Polling entry), [`MeowRobot/modules/helper_funcs/welcome.py`](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/welcome.py) (Welcome rendering), [`MeowRobot/modules/helper_funcs/chat_status.py`](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/chat_status.py) (Permission checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_entry["Polling entry<br/>[__main__.py]"]
  node_bot_core["Bot clients<br/>[__init__.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_event_bus["Event hooks<br/>[events.py]"]
  node_helper_misc["Message utilities<br/>[misc.py]"]
  node_formatting["Text formatting<br/>[string_handling.py]"]
  node_msg_types["Message types<br/>[msg_types.py]"]
end

subgraph group_moderation["Moderation and controls"]
  node_admin["Group administration<br/>[admin.py]"]
  node_connection["Group connections<br/>[connection.py]"]
  node_locks["Message locks<br/>[locks.py]"]
  node_disable["Command disabling<br/>[disable.py]"]
  node_night_mode["Night mode<br/>[nightmode.py]"]
  node_chat_status["Permission checks<br/>[chat_status.py]"]
end

subgraph group_community["Community features"]
  node_welcome["Welcome and goodbye<br/>[welcome.py]"]
  node_welcome_helpers["Welcome rendering<br/>[welcome.py]"]
  node_notes["Notes<br/>[notes.py]"]
  node_filters["Custom filters<br/>[cust_filters.py]"]
  node_chatbot["AI chatbot<br/>[chatbot.py]"]
end

subgraph group_persistence["Persistence"]
  node_sql_init["SQL sessions<br/>[__init__.py]"]
  node_sql_connection["Connection records<br/>[connection_sql.py]"]
  node_sql_locks["Lock records<br/>[locks_sql.py]"]
  node_sql_welcome["Welcome records<br/>[welcome_sql.py]"]
  node_sql_users["User records<br/>[users_sql.py]"]
  node_sql_global_bans["Global ban records<br/>[global_bans_sql.py]"]
  node_sql_filters["Filter records"]
  node_database[("SQL database")]
end

node_user(("Telegram users"))
node_telegram{{"Telegram"}}
node_chatbot_api{{"Chatbot API"}}

node_user -->|"sends updates"| node_telegram
node_telegram -->|"delivers updates"| node_entry
node_entry -->|"polls updates"| node_telegram
node_entry -->|"uses clients"| node_bot_core
node_bot_core -->|"loads settings"| node_config
node_entry -->|"imports sessions"| node_sql_init
node_entry -->|"imports checks"| node_chat_status
node_entry -->|"imports utilities"| node_helper_misc
node_entry -->|"imports user data"| node_sql_users
node_connection -->|"checks status"| node_chat_status
node_connection -->|"reads and writes"| node_sql_connection
node_locks -->|"uses connection state"| node_connection
node_locks -->|"checks disabled commands"| node_disable
node_locks -->|"checks permissions"| node_chat_status
node_locks -->|"reads and writes"| node_sql_locks
node_disable -->|"checks permissions"| node_chat_status
node_disable -->|"uses SQL sessions"| node_sql_init
node_admin -->|"checks permissions"| node_chat_status
node_welcome -->|"handles member events"| node_welcome_helpers
node_welcome -->|"reads and writes"| node_sql_welcome
node_welcome_helpers -->|"uses message types"| node_msg_types
node_welcome_helpers -->|"formats messages"| node_formatting
node_welcome_helpers -->|"uses message utilities"| node_helper_misc
node_welcome_helpers -->|"checks chat status"| node_chat_status
node_welcome_helpers -->|"uses user records"| node_sql_users
node_welcome_helpers -->|"checks global bans"| node_sql_global_bans
node_notes -.->|"uses SQL storage"| node_sql_init
node_filters -->|"uses filter records"| node_sql_filters
node_night_mode -.->|"uses SQL storage"| node_sql_init
node_chatbot -.->|"requests responses"| node_chatbot_api
node_sql_connection -->|"uses sessions"| node_sql_init
node_sql_locks -->|"uses sessions"| node_sql_init
node_sql_welcome -->|"uses sessions"| node_sql_init
node_sql_users -->|"uses sessions"| node_sql_init
node_sql_global_bans -->|"uses sessions"| node_sql_init
node_sql_filters -->|"uses sessions"| node_sql_init
node_sql_init -->|"connects and creates tables"| node_database

click node_entry "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/__main__.py"
click node_bot_core "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/__init__.py"
click node_config "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/config.py"
click node_event_bus "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/events.py"
click node_admin "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/admin.py"
click node_connection "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/connection.py"
click node_locks "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/locks.py"
click node_disable "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/disable.py"
click node_welcome "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/welcome.py"
click node_welcome_helpers "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/welcome.py"
click node_notes "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/notes.py"
click node_filters "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/cust_filters.py"
click node_night_mode "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/nightmode.py"
click node_chatbot "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/chatbot.py"
click node_helper_misc "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/misc.py"
click node_chat_status "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/chat_status.py"
click node_formatting "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/string_handling.py"
click node_msg_types "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/msg_types.py"
click node_sql_init "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/__init__.py"
click node_sql_connection "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/connection_sql.py"
click node_sql_locks "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/locks_sql.py"
click node_sql_welcome "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/welcome_sql.py"
click node_sql_users "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/users_sql.py"
click node_sql_global_bans "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/global_bans_sql.py"
click node_sql_filters "https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/cust_filters_sql.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_entry,node_bot_core,node_config,node_event_bus,node_helper_misc,node_formatting,node_msg_types,node_user toneBlue
class node_admin,node_connection,node_locks,node_disable,node_night_mode,node_chat_status toneAmber
class node_welcome,node_welcome_helpers,node_notes,node_filters,node_chatbot,node_chatbot_api toneMint
class node_sql_init,node_sql_connection,node_sql_locks,node_sql_welcome,node_sql_users,node_sql_global_bans,node_sql_filters,node_database toneRose
class node_telegram toneIndigo
```

## Components

### Bot runtime

- [Polling entry](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/__main__.py): `MeowRobot/__main__.py`
- [Bot clients](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/__init__.py): `MeowRobot/__init__.py`
- [Configuration](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/config.py): `MeowRobot/config.py`
- [Event hooks](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/events.py): `MeowRobot/events.py`
- [Message utilities](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/misc.py): `MeowRobot/modules/helper_funcs/misc.py`
- [Text formatting](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/string_handling.py): `MeowRobot/modules/helper_funcs/string_handling.py`
- [Message types](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/msg_types.py): `MeowRobot/modules/helper_funcs/msg_types.py`

### Moderation and controls

- [Group administration](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/admin.py): `MeowRobot/modules/admin.py`
- [Group connections](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/connection.py): `MeowRobot/modules/connection.py`
- [Message locks](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/locks.py): `MeowRobot/modules/locks.py`
- [Command disabling](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/disable.py): `MeowRobot/modules/disable.py`
- [Night mode](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/nightmode.py): `MeowRobot/modules/nightmode.py`
- [Permission checks](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/chat_status.py): `MeowRobot/modules/helper_funcs/chat_status.py`

### Community features

- [Welcome and goodbye](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/welcome.py): `MeowRobot/modules/welcome.py`
- [Welcome rendering](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/helper_funcs/welcome.py): `MeowRobot/modules/helper_funcs/welcome.py`
- [Notes](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/notes.py): `MeowRobot/modules/notes.py`
- [Custom filters](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/cust_filters.py): `MeowRobot/modules/cust_filters.py`
- [AI chatbot](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/chatbot.py): `MeowRobot/modules/chatbot.py`

### Persistence

- [SQL sessions](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/__init__.py): `MeowRobot/modules/sql/__init__.py`
- [Connection records](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/connection_sql.py): `MeowRobot/modules/sql/connection_sql.py`
- [Lock records](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/locks_sql.py): `MeowRobot/modules/sql/locks_sql.py`
- [Welcome records](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/welcome_sql.py): `MeowRobot/modules/sql/welcome_sql.py`
- [User records](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/users_sql.py): `MeowRobot/modules/sql/users_sql.py`
- [Global ban records](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/global_bans_sql.py): `MeowRobot/modules/sql/global_bans_sql.py`
- [Filter records](https://github.com/thealoneteam/meowrobot/blob/master/MeowRobot/modules/sql/cust_filters_sql.py): `MeowRobot/modules/sql/cust_filters_sql.py`
- **SQL database**

### Other components

- **Telegram users**
- **Telegram**
- **Chatbot API**

## Connections

- Telegram users → Telegram: sends updates
- Telegram → Polling entry: delivers updates (evidence: `MeowRobot/__main__.py`)
- Polling entry → Telegram: polls updates (evidence: `MeowRobot/__main__.py`)
- Polling entry → Bot clients: uses clients (evidence: `MeowRobot/__main__.py`)
- Bot clients → Configuration: loads settings (evidence: `MeowRobot/__init__.py`)
- Polling entry → SQL sessions: imports sessions (evidence: `MeowRobot/__main__.py`)
- Polling entry → Permission checks: imports checks (evidence: `MeowRobot/__main__.py`)
- Polling entry → Message utilities: imports utilities (evidence: `MeowRobot/__main__.py`)
- Polling entry → User records: imports user data (evidence: `MeowRobot/__main__.py`)
- Group connections → Permission checks: checks status (evidence: `MeowRobot/modules/connection.py`)
- Group connections → Connection records: reads and writes (evidence: `MeowRobot/modules/connection.py`)
- Message locks → Group connections: uses connection state (evidence: `MeowRobot/modules/locks.py`)
- Message locks → Command disabling: checks disabled commands (evidence: `MeowRobot/modules/locks.py`)
- Message locks → Permission checks: checks permissions (evidence: `MeowRobot/modules/locks.py`)
- Message locks → Lock records: reads and writes (evidence: `MeowRobot/modules/locks.py`)
- Command disabling → Permission checks: checks permissions (evidence: `MeowRobot/modules/disable.py`)
- Command disabling → SQL sessions: uses SQL sessions
- Group administration → Permission checks: checks permissions (evidence: `MeowRobot/modules/admin.py`)
- Welcome and goodbye → Welcome rendering: handles member events (evidence: `MeowRobot/modules/welcome.py`)
- Welcome and goodbye → Welcome records: reads and writes (evidence: `MeowRobot/modules/welcome.py`)
- Welcome rendering → Message types: uses message types (evidence: `MeowRobot/modules/helper_funcs/welcome.py`)
- Welcome rendering → Text formatting: formats messages (evidence: `MeowRobot/modules/helper_funcs/welcome.py`)
- Welcome rendering → Message utilities: uses message utilities (evidence: `MeowRobot/modules/helper_funcs/welcome.py`)
- Welcome rendering → Permission checks: checks chat status (evidence: `MeowRobot/modules/helper_funcs/welcome.py`)
- Welcome rendering → User records: uses user records (evidence: `MeowRobot/modules/helper_funcs/welcome.py`)
- Welcome rendering → Global ban records: checks global bans (evidence: `MeowRobot/modules/helper_funcs/welcome.py`)
- Notes → SQL sessions: uses SQL storage
- Custom filters → Filter records: uses filter records (evidence: `MeowRobot/modules/sql/cust_filters_sql.py`)
- Night mode → SQL sessions: uses SQL storage
- AI chatbot → Chatbot API: requests responses
- Connection records → SQL sessions: uses sessions
- Lock records → SQL sessions: uses sessions (evidence: `MeowRobot/modules/sql/locks_sql.py`)
- Welcome records → SQL sessions: uses sessions (evidence: `MeowRobot/modules/sql/welcome_sql.py`)
- User records → SQL sessions: uses sessions (evidence: `MeowRobot/modules/sql/users_sql.py`)
- Global ban records → SQL sessions: uses sessions (evidence: `MeowRobot/modules/sql/global_bans_sql.py`)
- Filter records → SQL sessions: uses sessions (evidence: `MeowRobot/modules/sql/cust_filters_sql.py`)
- SQL sessions → SQL database: connects and creates tables (evidence: `MeowRobot/modules/sql/__init__.py`)
