Unofficial discord-interactions multi page embed handler
Project description
dinteractions-Paginator
Unofficial discord-interactions multi-page embed handler
Join our Discord server!
- Try out all the possible combinations of the paginator with
/example1
and/example2
, - Ask some questions,
- And give us feedback and suggestions!
Features
- Message per embed or persistent message
- Index select that can be turned on/off
- Select labels are generated based on embed's title
- Index button that can be turned on/off
- Ability to set the buttons to any emote, color or label
Installation
pip install -U dinteractions-Paginator
Dependencies
Example GIF:
Paginator with select:
Examples:
These simple examples show how to easily create interactive, multiple page embeds that annyone can interact with that automatically deactivate after 60 seconds of inactivity:
Slash command:
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
from dinteractions_Paginator import Paginator
bot = commands.Bot(command_prefix="/")
slash = SlashCommand(bot, sync_commands=True)
@slash.slash(name="embeds")
async def embeds(ctx: SlashContext):
one = discord.Embed(title="1st Embed", description="General Kenobi!", color=discord.Color.red())
two = discord.Embed(title="2nd Embed", description="General Kenobi!", color=discord.Color.orange())
three = discord.Embed(title="3rd Embed", description="General Kenobi!", color=discord.Color.gold())
four = discord.Embed(title="4th Embed", description="General Kenobi!", color=discord.Color.green())
five = discord.Embed(title="5th Embed", description="General Kenobi!", color=discord.Color.blue())
pages = [one, two, three, four, five]
await Paginator(bot=bot, ctx=ctx, pages=pages, content=["1", "2", "3", "4", "5"], timeout=60)
bot.run("token")
Normal command:
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from dinteractions_Paginator import Paginator
bot = commands.Bot(command_prefix="t")
slash = SlashCommand(bot)
@bot.command()
async def embeds(ctx):
one = discord.Embed(title="1st Embed", description="General Kenobi!", color=discord.Color.red())
two = discord.Embed(title="2nd Embed", description="General Kenobi!", color=discord.Color.orange())
three = discord.Embed(title="3rd Embed", description="General Kenobi!", color=discord.Color.gold())
four = discord.Embed(title="4th Embed", description="General Kenobi!", color=discord.Color.green())
five = discord.Embed(title="5th Embed", description="General Kenobi!", color=discord.Color.blue())
pages = [one, two, three, four, five]
await Paginator(bot=bot, ctx=ctx, pages=pages, content=["1", "2", "3", "4", "5"], timeout=60)
bot.run("token")
NOTE: slash = SlashCommand(bot)
required to override bot
Arguments
Required:
bot
-commands.Bot
: The bot variable,commands.Bot
is requiredctx
-Union[Context, SlashContext]
: The context of a commandpages
-List[discord.Embed]
: A list of embeds to be paginated
Optional:
content
-Optional[Union[str, List[str]]]
: the content of the message to send, defaults toNone
authorOnly
-Optional[bool]
: if you want the paginator to work for the author only, default isFalse
onlyFor
-Optional[Union[discord.User, discord.Role, List[Union[discord.User, discord.Role]]]]
: components only for specified user(s) or role(s)
Time:
timeout
-Optional[int]
: deactivates paginator after inactivity if enabled, defaults toNone
(meaning no timeout)disableAfterTimeout
-Optional[bool]
: disable components aftertimeout
, defaultTrue
deleteAfterTimeout
-Optional[bool]
: delete components aftertimeout
, defaultFalse
What to use:
useButtons
-Optional[bool]
: uses buttons, default isTrue
useSelect
-Optional[bool]
: uses a select, default isTrue
useIndexButton
-Optional[bool]
: uses the index button, default isFalse
and staysFalse
ifuseButtons
is alsoFalse
useLinkButton
-Optional[bool]
: uses the link buttonuseFirstLast
-Optional[bool]
: uses the first and last buttons, defaultTrue
Labels:
firstLabel
-Optional[str]
: The label of the button used to go to the first page, defaults to""
prevLabel
-Optional[str]
: The label of the button used to go to the previous page, defaults to""
indexLabel
-Optional[str]
: The label of the index button, defaults to"Page"
nextLabel
-Optional[str]
: The label of the button used to go to the next page, defaults to""
lastLabel
-Optional[str]
: The label of the button used to go to the last page, defaults to""
linkLabel
-Optional[Union[str, List[str]]]
: The label for the link buttonlinkURL
-Optional[Union[str, List[str]]]
: The URL(s) for the link buttoncustomButtonLabel
=Optional[str]
: The label of a custom disabled button, defaultNone
Emojis:
firstEmoji
-Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict, bytes]
: emoji of the button used to go to the first page, defaults to"⏮️"
prevEmoji
-Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict, bytes]
: emoji of the button used to go to the previous page, defaults to"◀"
nextEmoji
-Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict, bytes]
: emoji of the button used to go to the next page, defaults to"▶"
lastEmoji
-Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict, bytes]
: emoji of the button used to go to the last page, defaults to"⏭️"
customButtonEmoji
-Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict, bytes]
: emoji of the custom disabled button, defaults toNone
Styles (the colo[u]r of the buttons):
firstStyle
-Optional[Union[ButtonStyle, int]]
: the style of button (ButtonStyle
orint
) for the first button, defaults to1
(ButtonStyle.blue
)prevStyle
-Optional[Union[ButtonStyle, int]]
: the style of button (ButtonStyle
orint
) for the previous button, defaults to1
(ButtonStyle.blue
)indexStyle
-Optional[Union[ButtonStyle, int]]
: the style of button (ButtonStyle
orint
) for the index button, defaults to3
(ButtonStyle.green
)nextStyle
-Optional[Union[ButtonStyle, int]]
: the style of button (ButtonStyle
orint
) for the next button, defaults to1
(ButtonStyle.blue
)lastStyle
-Optional[Union[ButtonStyle, int]]
: the style of button (ButtonStyle
orint
) for the last button, defaults to1
(ButtonStyle.blue
)customButtonStyle
-Optional[Union[ButtonStyle, int]]
: the style of button (ButtonStyle
orint
) for the last button, defaults to2
(ButtonStyle.gray
)
Credits
- Contributors of discord-interactions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for dinteractions_Paginator-1.1.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54d253e35544d95ed31fcaa8f1a6ac513e1c8cb994820dfefb7e3add64e25182 |
|
MD5 | f6e67faa87d9cafb778226aa5845ce42 |
|
BLAKE2b-256 | 4822199f810748973f154ca9c1835112573bdc7208429d9728aa2520d3a5bfd6 |
Close
Hashes for dinteractions_Paginator-1.1.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d346bdc6962ba1b8d97ea61901ac21ca02484e4bbe546de0308518ad3e59542 |
|
MD5 | 9416a3e467cbc220ae5b3c771de8f144 |
|
BLAKE2b-256 | 0730e43f3b5fe833754440fcbdf191daa297b07caeef7f7498a0907f32c2a73e |