2
0
mirror of https://github.com/Nick80835/microbot synced 2025-09-03 07:55:52 +00:00

add lenient commands

This commit is contained in:
Nick80835
2025-06-19 07:31:45 -04:00
parent f82680b334
commit 6a13085bd4
2 changed files with 18 additions and 5 deletions

View File

@@ -56,6 +56,7 @@ class Loader():
def reload_all_modules(self):
self.command_handler.incoming_commands = []
self.command_handler.incoming_lenient_commands = []
self.command_handler.inline_photo_commands = []
self.command_handler.inline_article_commands = []
self.command_handler.callback_queries = []
@@ -82,6 +83,15 @@ class Loader():
return decorator
def add_lenient(self, pattern: str = None, **args):
def decorator(func):
args["pattern"] = args.get("pattern", pattern)
self.command_handler.incoming_lenient_commands.append(Command(func, args))
return func
return decorator
def add_list(self, pattern: list = None, **args):
pattern_list = args.get("pattern", pattern)