From 97d7dc7e25addac315f5f389f15ea58d25ab98b7 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Fri, 8 Jun 2018 14:29:58 -0800 Subject: [PATCH] Add detailed help for commands --- src/exts/utils.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/exts/utils.py b/src/exts/utils.py index 2f65397..ee44707 100644 --- a/src/exts/utils.py +++ b/src/exts/utils.py @@ -701,17 +701,17 @@ class Utils: # TODO Create Help command @commands.command(name='help', aliases=['h']) @commands.cooldown(1, 5, commands.BucketType.user) - async def custom_help(self, ctx, command: str=None): + async def custom_help(self, ctx, *, command: str=None): pag = utils.Paginator(self.bot, embed=True, max_line_length=48) prefixes = await self.bot.get_custom_prefix(self.bot, ctx.message) if isinstance(prefixes, list): prefixes = ', '.join(prefixes) owner = await self.bot.get_user_info(self.bot.owner_id) - pag.set_embed_meta(title='Geeksbot Help', - description=f'For more information about a command please run\n' - f'{prefixes.split(",")[0]}help [group] ', - thumbnail=f'{ctx.guild.me.avatar_url}') if command is None: + pag.set_embed_meta(title='Geeksbot Help', + description=f'For more information about a command please run\n' + f'{prefixes.split(",")[0]}help [group] ', + thumbnail=f'{ctx.guild.me.avatar_url}') pag.add(f"\uFFF6Welcome to Geeksbot's help command.\n" f"< {self.bot.description} >\n\n" f"Below you will find some basic information about me.\n\n" @@ -735,6 +735,22 @@ class Utils: pass pag.add('\uFFF7') pag.add('\uFFF8') + else: + pag.set_embed_meta(title='Geeksbot Help', + thumbnail=f'{ctx.guild.me.avatar_url}') + command = command.split(maxsplit=1) + if command[0] in self.bot.all_commands: + if len(command) > 1 and self.bot.all_commands[command[0]].group: + command = self.bot.all_commands[command[0]].all_commands.get(command[1], None) + else: + command = self.bot.all_commands[command[0]] + else: + command = None + + if command and not command.hidden: + pag.add(f'\uFFF6{command.name}') + pag.add(f'{command.help}') + book = utils.Book(pag, (None, ctx.channel, self.bot, ctx.message)) await book.create_book()