replace-bot/filters/main.py
2023-03-28 11:15:03 +03:00

37 lines
961 B
Python

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):
if message.from_user.id in [int(i) for i in config.admin_users.split(",")]:
return True
else:
await message.answer("Хорошая попытка, но ты не администратор!")
return False