admin.py 340 B

12345678910111213141516
  1. from dataclasses import dataclass
  2. from aiogram import types
  3. from aiogram.dispatcher.filters.filters import BoundFilter
  4. from app import config
  5. @dataclass
  6. class IsAdmin(BoundFilter):
  7. key = "is_admin"
  8. is_admin: bool
  9. async def check(self, message: types.Message) -> bool:
  10. return message.from_user.id == config.ADMIN_ID