2022-02-16 18:13:44 +03:00
|
|
|
from aiogram import types
|
|
|
|
from aiogram.dispatcher.filters import BoundFilter
|
|
|
|
|
|
|
|
from load import config
|
|
|
|
|
|
|
|
'''
|
|
|
|
class OnlyMy(BoundFilter):
|
|
|
|
key = 'only_my'
|
|
|
|
|
|
|
|
def __init__(self, only_my):
|
|
|
|
self.onlymy = only_my
|
|
|
|
|
|
|
|
async def check(self, message: types.Message):
|
|
|
|
logging.info("User: {user_id} - {username}".format(
|
|
|
|
user_id=str(message.from_user.id),
|
|
|
|
username=str(message.from_user.username)
|
|
|
|
))
|
|
|
|
if message.from_user.id in config.allowed_users:
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
class BotAdmin(BoundFilter):
|
|
|
|
key = 'admin'
|
|
|
|
|
|
|
|
def __init__(self, admin):
|
|
|
|
self.admin = admin
|
|
|
|
|
|
|
|
async def check(self, message: types.Message):
|
2023-03-28 11:15:03 +03:00
|
|
|
if message.from_user.id in [int(i) for i in config.admin_users.split(",")]:
|
2022-02-16 18:13:44 +03:00
|
|
|
return True
|
|
|
|
else:
|
|
|
|
await message.answer("Хорошая попытка, но ты не администратор!")
|
|
|
|
return False
|
|
|
|
|