From 42d958d22d01223a00447de1f52c08e8c76cf39c Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 19 Aug 2019 16:56:51 -0500 Subject: [PATCH] Added basic support for permission_level on the commands --- GeoffreyBot/geoffrey.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/GeoffreyBot/geoffrey.py b/GeoffreyBot/geoffrey.py index 3f6b3c6..99ea5ce 100644 --- a/GeoffreyBot/geoffrey.py +++ b/GeoffreyBot/geoffrey.py @@ -113,8 +113,9 @@ class GeoffreyBot(commands.Bot): command_args = '' await self.send_error_message( - 'Geoffrey encountered unhandled exception: {} Command: **{}** Context: {}' - .format(error, ctx.invoked_with, command_args)) + 'Geoffrey encountered unhandled exception: {} Command: **{}** Context: {}'.format(error, + ctx.invoked_with, + command_args)) error_message = ["```python"] for tb in traceback.format_tb(error.original.__traceback__): @@ -184,20 +185,21 @@ class GeoffreyBot(commands.Bot): help_list = [] largest_command_size = 0 for command in self.command_list: - if largest_command_size < len(command["command"]): - largest_command_size = len(command["command"]) + if command["permission_level"] == "PLAYER": + if largest_command_size < len(command["command"]): + largest_command_size = len(command["command"]) for line in self.description.split("\n"): help_list.append(line) - help_list.append("\nCommands:") + help_list.append("\n**__Commands:__**") for command in self.command_list: - name = command["command"].ljust(largest_command_size + 2) - help_list.append(" {}{}{}".format(self.prefix, name, command["help"])) + if command["permission_level"] == "PLAYER": + name = command["command"] + help_list.append("**{}{}** - {}".format(self.prefix, name, command["help"])) help_list.append("\nDo ?help to get more info on any of the commands above") - return help_list def build_help_dict(self):