From 66698ad7be10c4edf5a60380be93a0e88c5223f1 Mon Sep 17 00:00:00 2001 From: ITQ Date: Wed, 19 Feb 2025 14:37:20 +0300 Subject: [PATCH] feat(telegram_bot): added filters folder --- .../services/telegram_bot/filters/__init__.py | 0 solution/services/telegram_bot/filters/auth.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 solution/services/telegram_bot/filters/__init__.py create mode 100644 solution/services/telegram_bot/filters/auth.py diff --git a/solution/services/telegram_bot/filters/__init__.py b/solution/services/telegram_bot/filters/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/solution/services/telegram_bot/filters/auth.py b/solution/services/telegram_bot/filters/auth.py new file mode 100644 index 0000000..ef1905a --- /dev/null +++ b/solution/services/telegram_bot/filters/auth.py @@ -0,0 +1,17 @@ +from aiogram.filters import Filter +from aiogram.fsm.context import FSMContext +from aiogram.types import Message + + +class AuthenticatedFilter(Filter): + def __init__(self) -> None: + pass + + async def __call__( + self, + message: Message, + state: FSMContext, + ) -> bool: + state_data = await state.get_data() + + return bool(state_data.get("authenticated"))