This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Telegram/modules/custom_filters.py

16 lines
530 B
Python
Raw Normal View History

2023-01-03 14:02:39 +02:00
"""Custom message filters made to improve commands
usage in context of Holo Users."""
2022-12-27 19:46:17 +02:00
from app import isAnAdmin
from modules.database import col_applications
from pyrogram import filters
2023-01-03 14:17:59 +02:00
from pyrogram.types import Message
2022-12-27 19:46:17 +02:00
2023-01-03 14:17:59 +02:00
async def admin_func(_, __, msg: Message):
return await isAnAdmin(msg.from_user.id)
2022-12-27 19:46:17 +02:00
2023-01-03 14:17:59 +02:00
async def allowed_func(_, __, msg: Message):
2022-12-27 19:46:17 +02:00
return True if (col_applications.find_one({"user": msg.from_user.id}) is not None) else False
admin = filters.create(admin_func)
allowed = filters.create(allowed_func)