diff --git a/src/cogs/help.py b/src/cogs/help.py new file mode 100644 index 0000000..23db1ae --- /dev/null +++ b/src/cogs/help.py @@ -0,0 +1,28 @@ +import discord +from discord.ext import commands + + +def create_embed(title=None, description=None, author=None, fields=None, image=None, thumbnail=None, + color=discord.Color.teal()): + if title: + embed = discord.Embed(title=title, color=color) + else: + embed = discord.Embed(color=color) + if description: + embed.description = description + if author: + embed.set_author(name="For " + author.name, icon_url=author.avatar_url) + if fields: + for field in fields: + embed.add_field(name=field[0], value=field[1], inline=field[2] if len(field) > 2 else False) + if image: + embed.set_image(url=image) + if thumbnail: + embed.set_thumbnail(url=thumbnail) + return embed + +class BotHelpCommand(commands.MinimalHelpCommand): + async def send_pages(self): + destination = self.get_destination() + embed = create_embed("John Peter: Help", description="".join(self.paginator.pages)) + await destination.send(embed=embed) \ No newline at end of file diff --git a/src/main.py b/src/main.py index 652629b..49361fd 100644 --- a/src/main.py +++ b/src/main.py @@ -11,6 +11,7 @@ from discord.ext.commands import MissingAnyRole, BadArgument, ExpectedClosingQuoteError, CommandInvokeError from raygun4py import raygunprovider +from cogs.help import BotHelpCommand from utils.commands import OnlyAllowedInChannels, RequiresVoiceChannel from utils.exceptions import BugReport @@ -55,6 +56,8 @@ def command_prefix(bot, message): ) logging.basicConfig(level=logging.INFO) +bot.help_command = BotHelpCommand() + initial_cogs = [ "cogs.team-builder", "cogs.cleverbot",