From f55084e33e81f9b37873e5b1e4130abf40310f19 Mon Sep 17 00:00:00 2001 From: ddorn Date: Wed, 29 Apr 2020 01:57:14 +0200 Subject: [PATCH] :sparkles: help for a command --- src/cogs/misc.py | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/cogs/misc.py b/src/cogs/misc.py index 35333ec..7992abc 100644 --- a/src/cogs/misc.py +++ b/src/cogs/misc.py @@ -53,20 +53,8 @@ class MiscCog(Cog, name="Divers"): if not args: await self.send_bot_help(ctx) - return else: - pass - - embed = discord.Embed( - title="Help for `!draw`", - description="Groupe qui continent des commande pour les tirages", - color=0xFFA500, - ) - # embed.set_author(name="*oooo*") - embed.add_field(name="zoulou", value="okokok", inline=True) - embed.add_field(name="lklk", value="mnmn", inline=True) - embed.set_footer(text="thankss!") - await ctx.send(embed=embed) + await self.send_command_help(ctx, args) async def send_bot_help(self, ctx: Context): embed = discord.Embed( @@ -107,6 +95,34 @@ class MiscCog(Cog, name="Divers"): await ctx.send(embed=embed) + async def send_command_help(self, ctx, args): + name = " ".join(args) + comm: Command = self.bot.get_command(name) + if comm is None: + await ctx.send( + f"La commande `!{name}` n'existe pas. " + f"Utilise `!help` pour une liste des commandes." + ) + return + + embed = discord.Embed( + title=f"Aide pour la commande `!{comm.qualified_name}`", + description=comm.help, + color=0xFFA500, + ) + + # embed.set_author(name="*oooo*") + if comm.aliases: + aliases = ", ".join(f"`{a}`" for a in comm.aliases) + embed.add_field(name="Alias", value=aliases, inline=True) + if comm.signature: + embed.add_field( + name="Usage", value=f"`!{comm.qualified_name} {comm.signature}`" + ) + embed.set_footer(text="Suggestion ? Problème ? Envoie un message à @Diego") + + await ctx.send(embed=embed) + def _name(self, command: Command): return f"`!{command.qualified_name}`"