Added support for "general" module

This commit is contained in:
Profitroll 2023-01-03 21:46:16 +01:00
parent 3d4dd29205
commit aad5c4f9f2
5 changed files with 11 additions and 3 deletions

View File

@ -31,6 +31,9 @@
"location": "logs" "location": "logs"
}, },
"features": { "features": {
"general": {
"enabled": true
},
"applications": { "applications": {
"enabled": true "enabled": true
}, },

View File

@ -7,7 +7,7 @@ from modules.utils import logWrite, locale, should_quote
from modules import custom_filters from modules import custom_filters
# Message command ============================================================================================================== # Message command ==============================================================================================================
@app.on_message(~filters.scheduled & filters.command(["message"], prefixes=["/"]) & custom_filters.admin) @app.on_message(custom_filters.enabled_general & ~filters.scheduled & filters.command(["message"], prefixes=["/"]) & custom_filters.admin)
async def cmd_message(app: Client, msg: Message): async def cmd_message(app: Client, msg: Message):
try: try:

View File

@ -11,7 +11,7 @@ from modules import custom_filters
pid = getpid() pid = getpid()
# Shutdown command ============================================================================================================= # Shutdown command =============================================================================================================
@app.on_message(~filters.scheduled & filters.private & filters.command(["kill", "die", "reboot"], prefixes=["/"]) & custom_filters.admin) @app.on_message(custom_filters.enabled_general & ~filters.scheduled & filters.private & filters.command(["kill", "die", "reboot"], prefixes=["/"]) & custom_filters.admin)
async def cmd_kill(app: Client, msg: Message): async def cmd_kill(app: Client, msg: Message):
logWrite(f"Shutting down bot with pid {pid}") logWrite(f"Shutting down bot with pid {pid}")

View File

@ -4,6 +4,7 @@ from pyrogram import filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, User, Message from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, User, Message
from pyrogram.client import Client from pyrogram.client import Client
from modules.utils import locale from modules.utils import locale
from modules import custom_filters
from classes.holo_user import HoloUser from classes.holo_user import HoloUser
class DefaultRulesMarkup(list): class DefaultRulesMarkup(list):
@ -35,7 +36,7 @@ class DefaultRulesMarkup(list):
# Rules command ============================================================================================================= # Rules command =============================================================================================================
@app.on_message(~ filters.scheduled & filters.private & filters.command(["rules"], prefixes=["/"])) @app.on_message(custom_filters.enabled_general & ~filters.scheduled & filters.private & filters.command(["rules"], prefixes=["/"]))
async def cmd_rules(app: Client, msg: Message): async def cmd_rules(app: Client, msg: Message):
await msg.reply_text(locale("rules_msg", locale=msg.from_user), disable_web_page_preview=True, reply_markup=DefaultRulesMarkup(msg.from_user).keyboard) await msg.reply_text(locale("rules_msg", locale=msg.from_user), disable_web_page_preview=True, reply_markup=DefaultRulesMarkup(msg.from_user).keyboard)
# ============================================================================================================================== # ==============================================================================================================================

View File

@ -13,6 +13,9 @@ 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_general_func(_, __, msg: Message):
return configGet("enabled", "features", "general")
async def enabled_applications_func(_, __, msg: Message): async def enabled_applications_func(_, __, msg: Message):
return configGet("enabled", "features", "applications") return configGet("enabled", "features", "applications")
@ -31,6 +34,7 @@ async def enabled_dinovoice_func(_, __, msg: Message):
admin = filters.create(admin_func) admin = filters.create(admin_func)
allowed = filters.create(allowed_func) allowed = filters.create(allowed_func)
enabled_general = filters.create(enabled_general_func)
enabled_applications = filters.create(enabled_applications_func) enabled_applications = filters.create(enabled_applications_func)
enabled_sponsorships = filters.create(enabled_sponsorships_func) enabled_sponsorships = filters.create(enabled_sponsorships_func)
enabled_warnings = filters.create(enabled_warnings_func) enabled_warnings = filters.create(enabled_warnings_func)