Init commit
This commit is contained in:
6
filters/__init__.py
Normal file
6
filters/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from load import dp
|
||||
|
||||
from .admin import IsAdmin
|
||||
|
||||
|
||||
dp.filters_factory.bind(IsAdmin)
|
14
filters/admin.py
Normal file
14
filters/admin.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from aiogram.types import Message
|
||||
from aiogram.dispatcher.filters import BoundFilter
|
||||
|
||||
from utils.database.base import get_admins
|
||||
|
||||
|
||||
class IsAdmin(BoundFilter):
|
||||
key = 'is_admin'
|
||||
|
||||
def __init__(self, is_admin):
|
||||
self.is_admin = is_admin
|
||||
|
||||
async def check(self, message: Message):
|
||||
return message.from_user.id in get_admins()
|
Reference in New Issue
Block a user