Prototype help command going into action

Not working fully
pull/8/head
sgoudham 4 years ago
parent 2b789ae5ad
commit 74ce5cd2fb

@ -1,60 +1,65 @@
import discord import datetime
from discord import Embed
from discord.ext import commands from discord.ext import commands
from settings import enso_embedmod_colours
class helper(commands.Cog, command_attrs=dict(hidden=True)):
"""Help Command!"""
# Set up the cog
class testinghelp(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
@commands.command(name="help2") @commands.command(hidden=True)
@commands.has_permissions(add_reactions=True, embed_links=True) async def help2(self, ctx, *cog):
async def help(self, ctx, *cog): if not cog:
"""Gets all cogs and commands of mine.""" coggers = Embed(title="(っ◔◡◔)っ Custom Help (っ◔◡◔)っ",
try: colour=enso_embedmod_colours,
if not cog: timestamp=datetime.datetime.utcnow(), )
"""Cog listing. What more?""" coggers.set_thumbnail(url=ctx.guild.icon_url)
halp = discord.Embed(title='Cog Listing and Uncatergorized Commands', cog_desc = ''
description='Use `~help *cog*` to find out more about them!\n(BTW, the Cog Name Must Be in Title Case, Just Like this Sentence.)') for x in self.bot.cogs:
cogs_desc = '' cog_desc += f"**{x}** - {self.bot.cogs[x].__doc__}\n"
for x in self.bot.cogs: coggers.add_field(name="Cogs", value=cog_desc[0:len(cog_desc) - 1], inline=False)
cogs_desc += ('{} - {}'.format(x, self.bot.cogs[x].__doc__) + '\n') await ctx.message.add_reaction(emoji="✉️")
halp.add_field(name='Cogs', value=cogs_desc[0:len(cogs_desc) - 1], inline=False) await ctx.send(embed=coggers)
cmds_desc = '' else:
for y in self.bot.walk_commands(): if len(cog) > 1:
if not y.cog_name and not y.hidden: coggers = Embed(title="Error!",
cmds_desc += ('{} - {}'.format(y.name, y.help) + '\n') description="Too Many Cogs!",
halp.add_field(name='Uncatergorized Commands', value=cmds_desc[0:len(cmds_desc) - 1], inline=False) colour=enso_embedmod_colours)
await ctx.message.add_reaction(emoji='') await ctx.send(embed=coggers)
await ctx.message.author.send('', embed=halp)
else: else:
"""Helps me remind you if you pass too many args.""" found = False
if len(cog) > 1: for x in self.bot.cogs:
halp = discord.Embed(title='Error!', description='That is way too many cogs!', for y in cog:
color=discord.Color.red()) if x == y:
await ctx.message.author.send('', embed=halp) coggers = Embed(colour=enso_embedmod_colours)
else: cogger_info = ''
"""Command listing within a cog.""" for c in self.bot.get_cog(y).get_commands():
found = False if not c.hidden:
cogger_info += f"**{c.name}** - {c.help}\n"
coggers.add_field(name=f"{cog[0]} Module - {self.bot.cogs[cog[0]].__doc__}",
value=cogger_info)
found = True
if not found:
for x in self.bot.cogs: for x in self.bot.cogs:
for y in cog: for c in self.bot.get_cog(x).get_commands():
if x == y: if c.name == cog[0]:
halp = discord.Embed(title=cog[0] + ' Command Listing', coggers = Embed(colour=enso_embedmod_colours)
description=self.bot.cogs[cog[0]].__doc__) coggers.add_field(name=f"{c.name} - {c.help}",
for c in self.bot.get_cog(y).get_commands(): value=f"Proper Syntax:\n`{c.qualified_name} {c.signature}`")
if not c.hidden:
halp.add_field(name=c.name, value=c.help, inline=False)
found = True found = True
if not found: if not found:
"""Reminds you if that cog doesn't exist.""" coggers = Embed(title="Error!",
halp = discord.Embed(title='Error!', description='How do you even use "' + cog[0] + '"?', description=f"How do you even use `{cog[0]}`?",
color=discord.Color.red()) colour=enso_embedmod_colours)
else: else:
await ctx.message.add_reaction(emoji='') await ctx.message.add_reaction(emoji="✉️")
await ctx.message.author.send('', embed=halp) await ctx.send(embed=coggers)
except:
await ctx.send("Excuse me, I can't send embeds.")
def setup(bot): def setup(bot):
bot.add_cog(testinghelp(bot)) bot.add_cog(helper(bot))

Loading…
Cancel
Save