Emilia application architecture
Telegram
A message arrives, a member joins, or someone presses a button.
Python clients
Pyrogram receives Telegram events for each bot identity.
Main bot
Runs Emilia's modules, including music and chatbot replies.
Hosted bots
Separate identities and sessions using shared modules.
Request handlers
The module for the requested feature checks access and performs the action.
Handlers use the services their request needs.
External work
Media preparation and external APIs. YouTube downloads use worker threads.
MongoDB
Group settings and saved records, including memory and clone leases.
Redis
Atomic music queue updates and shared cached data.