feat(bot): add async DB and FSM state handling

This commit is contained in:
2026-07-23 22:58:52 +05:00
parent b1c8f6d9f8
commit 87385228ea
28 changed files with 514 additions and 213 deletions
+5 -1
View File
@@ -9,22 +9,26 @@ logger = get_logger(__name__)
class AdminFilter(BaseFilter):
async def __call__(self, message: Message) -> bool:
allowed = message.from_user.id == ADMIN_ID # type: ignore[union-attr]
allowed = message.from_user.id == ADMIN_ID
if not allowed:
logger.warning(
"Отклонено сообщение от неавторизованного пользователя: user_id=%s",
message.from_user.id if message.from_user else None,
)
return allowed
class AdminCallbackFilter(BaseFilter):
async def __call__(self, callback: CallbackQuery) -> bool:
allowed = callback.from_user.id == ADMIN_ID
if not allowed:
logger.warning(
"Отклонен callback от неавторизованного пользователя: user_id=%s data=%s",
callback.from_user.id,
callback.data,
)
return allowed