Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/cogs/help.py
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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",
Expand Down