Advertisement
Guest User

Untitled

a guest
May 26th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. """This custom help command is a perfect replacement for the default one on any Discord Bot written in Discord.py Rewrite!
  2. However, you must put "bot.remove_command('help')" in your bot, and the command must be in a cog for it to work.
  3.  
  4. Written by Jared Newsom (AKA Jared M.F.)!"""
  5.  
  6. @commands.command()
  7. @commands.has_permissions(add_reactions=True,embed_links=True)
  8. async def help(self,ctx,*cog):
  9. """Gets all cogs and commands of mine."""
  10. try:
  11. if not cog:
  12. halp=discord.Embed(title='Cog Listing and Uncatergorized Commands',
  13. description='Use `!help *cog*` to find out more about them!\n(BTW, the Cog Name Must Be in Title Case, Just Like this Sentence.)')
  14. cogs_desc = ''
  15. for x in self.bot.cogs:
  16. cogs_desc += ('{} - {}'.format(x,self.bot.cogs[x].__doc__)+'\n')
  17. halp.add_field(name='Cogs',value=cogs_desc[0:len(cogs_desc)-1],inline=False)
  18. cmds_desc = ''
  19. for y in self.bot.walk_commands():
  20. if not y.cog_name and not y.hidden:
  21. cmds_desc += ('{} - {}'.format(y.name,y.help)+'\n')
  22. halp.add_field(name='Uncatergorized Commands',value=cmds_desc[0:len(cmds_desc)-1],inline=False)
  23. await ctx.message.add_reaction(emoji='✉')
  24. await ctx.message.author.send('',embed=halp)
  25. else:
  26. if len(cog) > 1:
  27. halp = discord.Embed(title='Error!',description='That is way too many cogs!',color=discord.Color.red())
  28. await ctx.message.author.send('',embed=halp)
  29. else:
  30. found = False
  31. for x in self.bot.cogs:
  32. for y in cog:
  33. if x == y:
  34. halp=discord.Embed(title=cog[0]+' Command Listing',description=self.bot.cogs[cog[0]].__doc__)
  35. for c in self.bot.get_cog(y).get_commands():
  36. if not c.hidden:
  37. halp.add_field(name=c.name,value=c.help,inline=False)
  38. found = True
  39. if not found:
  40. halp = discord.Embed(title='Error!',description='How do you even use "'+cog[0]+'"?',color=discord.Color.red())
  41. else:
  42. await ctx.message.add_reaction(emoji='✉')
  43. await ctx.message.author.send('',embed=halp)
  44. except:
  45. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement