2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-22 01:58:17 +00:00

allow commands to force the '/' prefix while being disableable

This commit is contained in:
Nick80835 2024-07-03 15:55:39 -04:00
parent fd4266ae7c
commit cc38f11c81
3 changed files with 3 additions and 2 deletions

View File

@ -31,6 +31,7 @@ class Command:
self.chance = args.get("chance", None)
self.fun = args.get("fun", False)
self.not_disableable = args.get("no_disable", False) or self.owner or self.sudo or self.admin
self.force_hard_prefix = args.get("force_hard_prefix", False)
self.no_private = args.get("no_private", False)
self.private_only = args.get("private_only", False)
self.silent_bail = args.get("silent_bail", False)

View File

@ -55,7 +55,7 @@ class CommandHandler():
elif command.raw_pattern:
pattern_match = search(RAW_PATTERN_TEMPLATE.format(command.pattern + command.pattern_extra), event.raw_text, IGNORECASE|DOTALL)
else:
if command.not_disableable:
if command.not_disableable or command.force_hard_prefix:
prefix_list = self.hard_prefix + [chat_prefix] + ["/"]
else:
prefix_list = self.hard_prefix + [chat_prefix]

View File

@ -54,7 +54,7 @@ async def help_cmd(event):
await event.reply(f"{prefix_help}<b>Available commands:</b>\n\n{help_string}", parse_mode="html")
@ldr.add("privacy")
@ldr.add("privacy", force_hard_prefix=True)
async def privacy_policy(event):
await event.reply(
f"This bot (\"**{bot_name}**\") stores the IDs of chats in which it receives messages as well as configurations associated with those chats such as command prefixes and disabled commands. "