A Cool Help Command - Full example of how it looks in action at the bottom
import discord, discord_colorize
from discord.ext import commands
colors = discord_colorize.Colors()
class MyNewHelp(commands.MinimalHelpCommand):
# Add extra init variables without overwriting the default ones
def __init__(self, **options):
super().__init__(**options)
self.baseEmbed = discord.Embed(
title="Help",
description="This is the help menu for the bot.\n\nUse `<help <command>` to get more detailed information about a command.\n\nIf the bot is having issues replying, please do `<addServer` and `<chatbot-set` in the channel you want the bot to reply in.\n",
color=0x53DA1C,
)
self.file = discord.File("logo.png", filename="image.png")
self.baseEmbed.add_field(
name="Lead Developers",
value=f"[**TheOnlyWayUp**](https://github.com/TheOnlyWayUp) • [**Yankee**](https://github.com/Yankee-the-gamer)",
inline=False,
)
self.baseEmbed.add_field(
name="\u200B",
value="[**Sponsored by Hydra-Hosting.eu**](https://hydra-hosting.eu)",
inline=False,
)
self.baseEmbed.set_image(
url="https://images-ext-1.discordapp.net/external/4p55wqGZlFa1cHVgsQdB8pB_eheWH8D5f6g-elEsPa0/https/media.discordapp.net/attachments/899954840019558400/933668820814549063/standard_1.gif"
)
self.baseEmbed.set_footer(icon_url="attachment://image.png", text="VIP Bots.")
async def send_pages(self):
halp = self.baseEmbed
halp.add_field(
name="__Servers__", value=f"{len(bot.guilds)} Guilds.", inline=True
)
halp.add_field(
name="__Users__",
value=f"{sum([guild.members for guild in bot.guilds])} Users.",
inline=True,
)
cogs_desc = ""
for x in bot.cogs:
cogs_desc += "{} - {}".format(x, bot.cogs[x].__doc__) + "\n"
halp.add_field(
name="Cogs", value=cogs_desc[0 : len(cogs_desc) - 1], inline=False
)
await self.get_destination().send(embed=halp, file=self.file)
async def send_command_help(self, command):
embed = discord.Embed(title=self.get_command_signature(command))
embed.add_field(name="Help", value=command.help)
alias = command.aliases
if alias:
embed.add_field(name="Aliases", value=", ".join(alias), inline=False)
channel = self.get_destination()
await channel.send(embed=embed)
def get_command_signature(self, command):
return "%s%s %s" % (
self.clean_prefix,
command.qualified_name,
command.signature,
)
async def send_bot_help(self, mapping):
try:
halp = self.baseEmbed
halp.add_field(
name="__Servers__", value=f"{len(bot.guilds)} Guilds.", inline=True
)
cogs_desc = ""
file = discord.File("logo.png", filename="image.png")
halp.set_thumbnail(url="attachment://image.png")
for x in bot.cogs:
cogs_desc += "{} - {}".format(x, bot.cogs[x].__doc__) + "\n"
await self.get_destination().send(embed=halp, file=self.file)
embed = discord.Embed(title="Detailed Help", color=0xB3FF7D)
for cog, commands in mapping.items():
filtered = await self.filter_commands(commands, sort=True)
command_signatures = [self.get_command_signature(c) for c in filtered]
command_help = [c.help for c in filtered]
cmds = [
f"`{c}`\n```ansi\n{colors.colorize(h, fg='green', bold=True)}```\n"
for c, h in zip(command_signatures, command_help)
]
if command_signatures:
cog_name = getattr(cog, "qualified_name", "No Category")
embed.add_field(name=cog_name, value="\n".join(cmds), inline=False)
channel = self.get_destination()
await channel.send(embed=embed)
except Exception as e:
console.log("Error at help - " + str(e))
bot.help_command = MyNewHelp()