Added basic support for permission_level on the commands

master
Joey Hines 2019-08-19 16:56:51 -05:00
parent 3892debb02
commit 42d958d22d
1 changed files with 10 additions and 8 deletions

View File

@ -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 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 <command name> to get more info on any of the commands above")
return help_list
def build_help_dict(self):