|
|
@ -44,7 +44,8 @@ class Pages:
|
|
|
|
Our permissions for the channel.
|
|
|
|
Our permissions for the channel.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, ctx, *, entries, per_page=12, show_entry_count=True):
|
|
|
|
def __init__(self, ctx, *, entries, per_page=6, show_entry_count=True):
|
|
|
|
|
|
|
|
|
|
|
|
self.bot = ctx.bot
|
|
|
|
self.bot = ctx.bot
|
|
|
|
self.entries = entries
|
|
|
|
self.entries = entries
|
|
|
|
self.message = ctx.message
|
|
|
|
self.message = ctx.message
|
|
|
@ -55,8 +56,8 @@ class Pages:
|
|
|
|
if left_over:
|
|
|
|
if left_over:
|
|
|
|
pages += 1
|
|
|
|
pages += 1
|
|
|
|
self.maximum_pages = pages
|
|
|
|
self.maximum_pages = pages
|
|
|
|
self.embed = discord.Embed(colour=enso_embedmod_colours,
|
|
|
|
self.embed = discord.Embed(colour=enso_embedmod_colours, # any HEX color here
|
|
|
|
timestamp=datetime.datetime.utcnow()) # any HEX color here
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
|
self.paginating = len(entries) > per_page
|
|
|
|
self.paginating = len(entries) > per_page
|
|
|
|
self.show_entry_count = show_entry_count
|
|
|
|
self.show_entry_count = show_entry_count
|
|
|
|
self.reaction_emojis = [
|
|
|
|
self.reaction_emojis = [
|
|
|
@ -358,6 +359,11 @@ class HelpPaginator(Pages):
|
|
|
|
async def from_cog(cls, ctx, cog):
|
|
|
|
async def from_cog(cls, ctx, cog):
|
|
|
|
cog_name = cog.__class__.__name__
|
|
|
|
cog_name = cog.__class__.__name__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ctx.guild is None:
|
|
|
|
|
|
|
|
icon = ctx.author.avatar_url
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
icon = ctx.guild.icon_url
|
|
|
|
|
|
|
|
|
|
|
|
# get the commands
|
|
|
|
# get the commands
|
|
|
|
entries = sorted(Cog.get_commands(cog), key=lambda c: c.name)
|
|
|
|
entries = sorted(Cog.get_commands(cog), key=lambda c: c.name)
|
|
|
|
|
|
|
|
|
|
|
@ -366,6 +372,7 @@ class HelpPaginator(Pages):
|
|
|
|
|
|
|
|
|
|
|
|
self = cls(ctx, entries)
|
|
|
|
self = cls(ctx, entries)
|
|
|
|
self.title = f'(っ◔◡◔)っ {cog_name} (っ◔◡◔)っ'
|
|
|
|
self.title = f'(っ◔◡◔)っ {cog_name} (っ◔◡◔)っ'
|
|
|
|
|
|
|
|
self.embed.set_thumbnail(url=icon)
|
|
|
|
self.description = inspect.getdoc(cog)
|
|
|
|
self.description = inspect.getdoc(cog)
|
|
|
|
self.prefix = cleanup_prefix(ctx.bot, ctx.prefix)
|
|
|
|
self.prefix = cleanup_prefix(ctx.bot, ctx.prefix)
|
|
|
|
|
|
|
|
|
|
|
@ -382,7 +389,15 @@ class HelpPaginator(Pages):
|
|
|
|
|
|
|
|
|
|
|
|
self = cls(ctx, entries)
|
|
|
|
self = cls(ctx, entries)
|
|
|
|
if not isinstance(command, discord.ext.commands.Group):
|
|
|
|
if not isinstance(command, discord.ext.commands.Group):
|
|
|
|
|
|
|
|
if command.aliases:
|
|
|
|
|
|
|
|
aliases = " | ".join(command.aliases)
|
|
|
|
|
|
|
|
self.title = f"{command.qualified_name} | {aliases} `{command.signature}`"
|
|
|
|
|
|
|
|
else:
|
|
|
|
self.title = f"{command.qualified_name} `{command.signature}`"
|
|
|
|
self.title = f"{command.qualified_name} `{command.signature}`"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if command.aliases:
|
|
|
|
|
|
|
|
aliases = " | ".join(command.aliases)
|
|
|
|
|
|
|
|
self.title = f"{command.name} | {aliases}"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.title = command.name
|
|
|
|
self.title = command.name
|
|
|
|
|
|
|
|
|
|
|
@ -421,8 +436,14 @@ class HelpPaginator(Pages):
|
|
|
|
nested_pages.extend(
|
|
|
|
nested_pages.extend(
|
|
|
|
(cog, description, plausible[i:i + per_page]) for i in range(0, len(plausible), per_page))
|
|
|
|
(cog, description, plausible[i:i + per_page]) for i in range(0, len(plausible), per_page))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ctx.guild is None:
|
|
|
|
|
|
|
|
icon = ctx.author.avatar_url
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
icon = ctx.guild.icon_url
|
|
|
|
|
|
|
|
|
|
|
|
self = cls(ctx, nested_pages, per_page=1) # this forces the pagination session
|
|
|
|
self = cls(ctx, nested_pages, per_page=1) # this forces the pagination session
|
|
|
|
self.prefix = cleanup_prefix(ctx.bot, ctx.prefix)
|
|
|
|
self.prefix = cleanup_prefix(ctx.bot, ctx.prefix)
|
|
|
|
|
|
|
|
self.embed.set_thumbnail(url=icon)
|
|
|
|
|
|
|
|
|
|
|
|
# swap the get_page implementation with one that supports our style of pagination
|
|
|
|
# swap the get_page implementation with one that supports our style of pagination
|
|
|
|
self.get_page = self.get_bot_page
|
|
|
|
self.get_page = self.get_bot_page
|
|
|
|