diff --git a/cogs/test.py b/cogs/test.py index 41a50afd..9b2d7a9f 100644 --- a/cogs/test.py +++ b/cogs/test.py @@ -4,7 +4,7 @@ from discord import Embed from discord.ext import commands from discord.ext.commands import is_owner -from settings import enso_embedmod_colours +from settings import enso_embedmod_colours, blank_space class helper(commands.Cog, command_attrs=dict(hidden=True)): @@ -16,52 +16,82 @@ class helper(commands.Cog, command_attrs=dict(hidden=True)): @commands.command(hidden=True) @is_owner() async def help2(self, ctx, *cog): + group_found = False if not cog: coggers = Embed(title="(っ◔◡◔)っ Custom Help (っ◔◡◔)っ", - description="Use ~help *cog* to find out more about them!", + description=f"Use **{ctx.prefix}help** `` to find out more about them!" + f"\n\n`[]` | **Optional**" + f"\n`<>` | **Required**", colour=enso_embedmod_colours, timestamp=datetime.datetime.utcnow()) + coggers.set_footer(text=f"Requested by {ctx.author}", icon_url='{}'.format(ctx.author.avatar_url)) coggers.set_thumbnail(url=ctx.guild.icon_url) cog_desc = '' for x in self.bot.cogs: cog_desc += f"**{x}** - {self.bot.cogs[x].__doc__}\n" - coggers.add_field(name="Cogs", value=cog_desc[0:len(cog_desc) - 1], inline=False) + coggers.add_field(name=blank_space, value=cog_desc[0:len(cog_desc) - 1], inline=False) await ctx.message.add_reaction(emoji="✉️") await ctx.send(embed=coggers) else: - if len(cog) > 1: - coggers = Embed(title="Error!", - description="Too Many Cogs!", - colour=enso_embedmod_colours) - await ctx.send(embed=coggers) - else: - found = False + found = False + for x in self.bot.cogs: + for y in cog: + if x == y: + coggers = Embed(title=f"(っ◔◡◔)っ {cog[0]} (っ◔◡◔)っ", colour=enso_embedmod_colours, + timestamp=datetime.datetime.utcnow()) + coggers.set_footer(text=f"Requested by {ctx.author}", + icon_url='{}'.format(ctx.author.avatar_url)) + for c in self.bot.get_cog(y).walk_commands(): + if not c.hidden: + if c.signature: + cogger_info = c.help + coggers.add_field(name=f"**{ctx.prefix}{c.qualified_name}** `{c.signature}`", + value=cogger_info, inline=False) + else: + cogger_info = c.help + coggers.add_field(name=f"**{ctx.prefix}{c.qualified_name}**", + value=cogger_info, inline=False) + await ctx.message.add_reaction(emoji="✉️") + found = True + if not found: for x in self.bot.cogs: - for y in cog: - if x == y: - coggers = Embed(colour=enso_embedmod_colours) - cogger_info = '' - for c in self.bot.get_cog(y).walk_commands(): - if not c.hidden: - cogger_info += f"**{c.qualified_name}** - {c.help}\n" - coggers.add_field(name=f"{cog[0]} Module - {self.bot.cogs[cog[0]].__doc__}", - value=cogger_info) + for c in self.bot.get_cog(x).walk_commands(): + if c.name == cog[0]: + if isinstance(c, commands.Group): + string = " ".join(cog) + group_found = True + for val in c.commands: + if string == val.qualified_name: + coggers = Embed(title="Proper Syntax", + description=f"**{val.help}" + f"\n{ctx.prefix}{val.qualified_name}** `{val.signature}`", + colour=enso_embedmod_colours, + timestamp=datetime.datetime.utcnow()) + coggers.set_footer(text=f"Requested by {ctx.author}", + icon_url='{}'.format(ctx.author.avatar_url)) + await ctx.message.add_reaction(emoji="✉️") + else: + coggers = Embed(title=f"Proper Syntax", + description=f"**{ctx.prefix}{c.qualified_name}** `{c.signature}` | {c.help}", + colour=enso_embedmod_colours, timestamp=datetime.datetime.utcnow()) + coggers.set_footer(text=f"Requested by {ctx.author}", + icon_url='{}'.format(ctx.author.avatar_url)) + await ctx.message.add_reaction(emoji="✉️") found = True if not found: - for x in self.bot.cogs: - for c in self.bot.get_cog(x).walk_commands(): - if c.name == cog[0]: - coggers = Embed(colour=enso_embedmod_colours) - coggers.add_field(name=f"{c.name} - {c.help}", - value=f"Proper Syntax: `{c.qualified_name} {c.signature}`") - found = True - if not found: + if group_found: + coggers = Embed(title="Error!", + description=f"How do you even use `{string}`?", + colour=enso_embedmod_colours, + timestamp=datetime.datetime.utcnow()) + else: coggers = Embed(title="Error!", description=f"How do you even use `{cog[0]}`?", - colour=enso_embedmod_colours) - else: - await ctx.message.add_reaction(emoji="✉️") - await ctx.send(embed=coggers) + colour=enso_embedmod_colours, + timestamp=datetime.datetime.utcnow()) + else: + await ctx.message.add_reaction(emoji="✉️") + await ctx.send(embed=coggers) def setup(bot):