| ⬅️ Back | 🏠 Docs Root |
The core/settings.py file acts as a central registry for the bot’s modular architecture. It defines which features and middlewares are active in the system.
Located in: src/telegram_bot/core/settings.py
INSTALLED_FEATURESA list of features that provide a user interface via Telegram (handlers, routers, keyboards).
Router Discovery to automatically assemble the bot’s routing table.src/telegram_bot/ (e.g., features.telegram.commands).INSTALLED_REDIS_FEATURESA list of features that act as listeners for Redis Streams.
RedisStreamProcessor to route incoming events (like notifications from the backend) to the correct logic.src/telegram_bot/ (e.g., features.redis.notifications).MIDDLEWARE_CLASSESA list of middleware modules to be applied to the bot’s dispatcher.
setup function (e.g., middlewares.user_validation).Note:
I18nMiddlewareis not included in this list because it is initialized and registered separately incore/factory.pyto handle its specific configuration requirements (locales compilation, FSM manager).
To register a new feature:
src/telegram_bot/features/.INSTALLED_FEATURES (if it has Telegram handlers) or INSTALLED_REDIS_FEATURES (if it listens to Redis).Example:
INSTALLED_FEATURES = [
...,
"features.telegram.my_new_feature",
]