Template
Initial commit: VPN Telegram bot (sanitized defaults)
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
"""Фильтры доступа."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from aiogram.filters import BaseFilter
|
||||
from aiogram.types import CallbackQuery, Message
|
||||
|
||||
from config import Settings
|
||||
|
||||
|
||||
class IsAdmin(BaseFilter):
|
||||
def __init__(self, settings: Settings) -> None:
|
||||
self._admin_ids = set(settings.admin_ids)
|
||||
|
||||
async def __call__(self, event: Message | CallbackQuery) -> bool:
|
||||
user = event.from_user
|
||||
if user is None:
|
||||
return False
|
||||
return user.id in self._admin_ids
|
||||
Reference in New Issue
Block a user