Init commit

This commit is contained in:
Jemacivan
2022-02-16 17:13:44 +02:00
commit 8060b933a5
42 changed files with 1281 additions and 0 deletions

7
filters/__init__.py Normal file
View File

@@ -0,0 +1,7 @@
from load import dp
from .main import BotAdmin #OnlyMy
if __name__ == "filters":
dp.filters_factory.bind(BotAdmin)
#dp.filters_factory.bind(OnlyMy)

36
filters/main.py Normal file
View File

@@ -0,0 +1,36 @@
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 config.admin_user:
return True
else:
await message.answer("Хорошая попытка, но ты не администратор!")
return False