def __init__(self, ctx, bot: commands.Bot, idx_emoji, idx_embed):
"""
Create a new PagedEmbed.
Arguments:
ctx : discord.ext.commands.Context
The context in which the command
to send the PagedEmbed was invoked.
bot : discord.ext.commands.Bot
The bot that the application is
logged in with. In Cogs, this is
usually saved as an instance
attribute `bot`.
idx_emoji : str
The Emoji which is used to navigate
to the initial page, constructed
through arguments and keyword
arguments passed to this constructor.
Example:
embed = PagedEmbed(ctx, bot, "??",
title="Index Page",
description="This page gets shown initially."
)
embed.add_page("??", discord.Embed(
title="Second Page",
description="This page gets shown when you click the ?? emoji."
))
"""
self._ctx = ctx
self._bot = bot
self._msg = None
# Dictionary to contain embed Pages in the following format:
# {
# "idx_emoji": discord.Embed,
# "emoji": discord.Embed,
# "emoji": discord.Embed,
# ...
# }
self._pages = {
idx_emoji: idx_embed
}
self.current_page = self._pages[idx_emoji]
# Attach our event listener to the bot
self._bot.add_listener(self.on_reaction_add)
评论列表
文章目录