mirror of
https://github.com/Nick80835/microbot
synced 2025-09-03 07:55:52 +00:00
add lenient commands
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user