Третья часть: сделаны обработчики команд
This commit is contained in:
13
BotCode/routers/common/__init__.py
Normal file
13
BotCode/routers/common/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# BotCode/routers/common/__init__.py
|
||||
# Инициализация пакета common, для работы со всеми сообщениями
|
||||
|
||||
from aiogram import Router
|
||||
from .messages import router as common_messages_router
|
||||
|
||||
|
||||
# Объявление роутера и настройка экспорта модулей
|
||||
__all__ = ("router",)
|
||||
router = Router(name="common_head_router")
|
||||
|
||||
# Идет самым последним, если другие роутеры не сработали
|
||||
router.include_router(common_messages_router)
|
||||
15
BotCode/routers/common/messages.py
Normal file
15
BotCode/routers/common/messages.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# BotCode/routers/common/messages.py
|
||||
# Обработчик всех сообщений
|
||||
|
||||
from aiogram import Router, types
|
||||
from BotLibrary import *
|
||||
|
||||
# Настройка экспорта модулей и роутера
|
||||
__all__ = ("router",)
|
||||
router = Router(name="common_msg_router")
|
||||
|
||||
|
||||
# Хэндлер на все сообщения и записывает данные
|
||||
@router.message()
|
||||
async def handle_all_messages(message: types.Message):
|
||||
await logger_msg(message)
|
||||
Reference in New Issue
Block a user