2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-30 22:16:05 +00:00

add a help command to list available commands

This commit is contained in:
Nick80835
2020-05-06 11:10:00 -04:00
parent 3751d7de9a
commit 5272c0c85e
2 changed files with 20 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ class Loader():
self.logger = logger
self.settings = settings
self.command_handler = CommandHandler(client, logger, settings)
self.help_dict = {}
self.botversion = "0.1.3"
def load_all_modules(self):
@@ -29,6 +30,7 @@ class Loader():
def reload_all_modules(self):
self.command_handler.incoming_commands = {}
self.help_dict = {}
errors = ""
@@ -47,6 +49,11 @@ class Loader():
pattern = args.get("pattern", pattern)
def decorator(func):
if func.__module__.split(".")[-1] in self.help_dict:
self.help_dict[func.__module__.split(".")[-1]] += [pattern]
else:
self.help_dict[func.__module__.split(".")[-1]] = [pattern]
self.command_handler.incoming_commands[pattern] = {
"function": func,
"noprefix": args.get('noprefix', False),