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
|
2023-01-03 21:33:53 +02:00
|
|
|
from modules.utils import configGet
|
2022-12-27 19:46:17 +02:00
|
|
|
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
|
|
|
|
|
2023-01-03 21:33:53 +02:00
|
|
|
async def enabled_feature_func(_, __, msg: Message, feature: str):
|
|
|
|
return configGet("enabled", "features", feature)
|
|
|
|
|
2022-12-27 19:46:17 +02:00
|
|
|
admin = filters.create(admin_func)
|
2023-01-03 21:33:53 +02:00
|
|
|
allowed = filters.create(allowed_func)
|
|
|
|
|
|
|
|
enabled_applications = filters.create(enabled_feature_func, kwargs={"feature": "applications"})
|
|
|
|
enabled_sponsorships = filters.create(enabled_feature_func, kwargs={"feature": "sponsorships"})
|
|
|
|
enabled_warnings = filters.create(enabled_feature_func, kwargs={"feature": "warnings"})
|
|
|
|
enabled_invites_check = filters.create(enabled_feature_func, kwargs={"feature": "invites_check"})
|
|
|
|
enabled_dinovoice = filters.create(enabled_feature_func, kwargs={"feature": "dinovoice"})
|