Overhauled a lot of tutorial code

Almost finished
(Really Messy)
pull/8/head
sgoudham 4 years ago
parent f7279c6fc9
commit 22c57b46d9

@ -4,7 +4,7 @@ from discord import Embed
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import is_owner 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)): class helper(commands.Cog, command_attrs=dict(hidden=True)):
@ -16,49 +16,79 @@ class helper(commands.Cog, command_attrs=dict(hidden=True)):
@commands.command(hidden=True) @commands.command(hidden=True)
@is_owner() @is_owner()
async def help2(self, ctx, *cog): async def help2(self, ctx, *cog):
group_found = False
if not cog: if not cog:
coggers = Embed(title="(っ◔◡◔)っ Custom Help (っ◔◡◔)っ", coggers = Embed(title="(っ◔◡◔)っ Custom Help (っ◔◡◔)っ",
description="Use ~help *cog* to find out more about them!", description=f"Use **{ctx.prefix}help** `<cog>` to find out more about them!"
f"\n\n`[]` | **Optional**"
f"\n`<>` | **Required**",
colour=enso_embedmod_colours, colour=enso_embedmod_colours,
timestamp=datetime.datetime.utcnow()) 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) coggers.set_thumbnail(url=ctx.guild.icon_url)
cog_desc = '' cog_desc = ''
for x in self.bot.cogs: for x in self.bot.cogs:
cog_desc += f"**{x}** - {self.bot.cogs[x].__doc__}\n" 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.message.add_reaction(emoji="✉️")
await ctx.send(embed=coggers) 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: else:
found = False found = False
for x in self.bot.cogs: for x in self.bot.cogs:
for y in cog: for y in cog:
if x == y: if x == y:
coggers = Embed(colour=enso_embedmod_colours) coggers = Embed(title=f"(っ◔◡◔)っ {cog[0]} (っ◔◡◔)っ", colour=enso_embedmod_colours,
cogger_info = '' 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(): for c in self.bot.get_cog(y).walk_commands():
if not c.hidden: if not c.hidden:
cogger_info += f"**{c.qualified_name}** - {c.help}\n" if c.signature:
coggers.add_field(name=f"{cog[0]} Module - {self.bot.cogs[cog[0]].__doc__}", cogger_info = c.help
value=cogger_info) 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 found = True
if not found: if not found:
for x in self.bot.cogs: for x in self.bot.cogs:
for c in self.bot.get_cog(x).walk_commands(): for c in self.bot.get_cog(x).walk_commands():
if c.name == cog[0]: if c.name == cog[0]:
coggers = Embed(colour=enso_embedmod_colours) if isinstance(c, commands.Group):
coggers.add_field(name=f"{c.name} - {c.help}", string = " ".join(cog)
value=f"Proper Syntax: `{c.qualified_name} {c.signature}`") 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 found = True
if not found: 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!", coggers = Embed(title="Error!",
description=f"How do you even use `{cog[0]}`?", description=f"How do you even use `{cog[0]}`?",
colour=enso_embedmod_colours) colour=enso_embedmod_colours,
timestamp=datetime.datetime.utcnow())
else: else:
await ctx.message.add_reaction(emoji="✉️") await ctx.message.add_reaction(emoji="✉️")
await ctx.send(embed=coggers) await ctx.send(embed=coggers)

Loading…
Cancel
Save