Added more custom filters

This commit is contained in:
Profitroll 2023-01-03 20:33:53 +01:00
parent 3442a478d4
commit d7936fa600

View File

@ -2,6 +2,7 @@
usage in context of Holo Users.""" usage in context of Holo Users."""
from app import isAnAdmin from app import isAnAdmin
from modules.utils import configGet
from modules.database import col_applications from modules.database import col_applications
from pyrogram import filters from pyrogram import filters
from pyrogram.types import Message from pyrogram.types import Message
@ -12,5 +13,14 @@ async def admin_func(_, __, msg: Message):
async def allowed_func(_, __, msg: Message): async def allowed_func(_, __, msg: Message):
return True if (col_applications.find_one({"user": msg.from_user.id}) is not None) else False return True if (col_applications.find_one({"user": msg.from_user.id}) is not None) else False
async def enabled_feature_func(_, __, msg: Message, feature: str):
return configGet("enabled", "features", feature)
admin = filters.create(admin_func) admin = filters.create(admin_func)
allowed = filters.create(allowed_func) 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"})