Skip to content

Instantly share code, notes, and snippets.

@That-Kidd
Created August 28, 2019 16:03
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save That-Kidd/432b028352a44e434dfd54e3676a6a85 to your computer and use it in GitHub Desktop.
Save That-Kidd/432b028352a44e434dfd54e3676a6a85 to your computer and use it in GitHub Desktop.
A kinda advanced custom "help" command for your Discord.py Rewrite bots!
"""This custom help command is a perfect replacement for the default one on any Discord Bot written in Discord.py Rewrite!
However, you must put "bot.remove_command('help')" in your bot, and the command must be in a cog for it to work.
Written by Jared Newsom (AKA Jared M.F.)!"""
@commands.command()
commands.has_permissions(add_reactions=True,embed_links=True)
async def help(self,ctx,*cog):
"""Gets all cogs and commands of mine."""
try:
if not cog:
halp=discord.Embed(title='Cog Listing and Uncatergorized Commands',
description='Use `!help *cog*` to find out more about them!\n(BTW, the Cog Name Must Be in Title Case, Just Like this Sentence.)')
cogs_desc = ''
for x in self.bot.cogs:
cogs_desc += ('{} - {}'.format(x,self.bot.cogs[x].__doc__)+'\n')
halp.add_field(name='Cogs',value=cogs_desc[0:len(cogs_desc)-1],inline=False)
cmds_desc = ''
for y in self.bot.walk_commands():
if not y.cog_name and not y.hidden:
cmds_desc += ('{} - {}'.format(y.name,y.help)+'\n')
halp.add_field(name='Uncatergorized Commands',value=cmds_desc[0:len(cmds_desc)-1],inline=False)
await ctx.message.add_reaction(emoji='✉')
await ctx.message.author.send('',embed=halp)
else:
if len(cog) > 1:
halp = discord.Embed(title='Error!',description='That is way too many cogs!',color=discord.Color.red())
await ctx.message.author.send('',embed=halp)
else:
found = False
for x in self.bot.cogs:
for y in cog:
if x == y:
halp=discord.Embed(title=cog[0]+' Command Listing',description=self.bot.cogs[cog[0]].__doc__)
for c in self.bot.get_cog(y).get_commands():
if not c.hidden:
halp.add_field(name=c.name,value=c.help,inline=False)
found = True
if not found:
halp = discord.Embed(title='Error!',description='How do you even use "'+cog[0]+'"?',color=discord.Color.red())
else:
await ctx.message.add_reaction(emoji='✉')
await ctx.message.author.send('',embed=halp)
except:
pass
@1-creare-1
Copy link

Thanks!

@CypherGuy
Copy link

I got this error:
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.Help' has no 'setup' function.
Any help please?

@Spaceish
Copy link

Spaceish commented May 15, 2021

I got this error:
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.Help' has no 'setup' function.
Any help please?

put this at the end of your help cog

def setup(yourbotname):
        yourbotname.add_cog(yourclassname(yourbotname))

and change "yourbotname" to your bot name , "yourclassname" to your class name

@CypherGuy
Copy link

I had figured that out, but thanks anyway!

@bsod2528
Copy link

Okay i keep getting 'help' command is not found in my terminal while running it. Other than that no issues though. please help

@wdw781
Copy link

wdw781 commented May 25, 2022

@bsod2528 you need to add :
def setup(bot):
bot.add_cog(Help(bot))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment