Skip to main content

Unofficial discord-interactions multi page embed handler

Project description

dinteractions-Paginator

Unofficial discord-interactions multi-page embed handler

Installation

pip install 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.

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="Hello there")
 
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="Hello there")
 
bot.run("token")

NOTE: slash = SlashCommand(bot) required

Arguments

Required:

  • bot - The bot variable, commands.Bot() is required
  • ctx - The context of a command; SlashContext
  • pages - List[discord.Embed]: A list of embeds to be paginated

Optional:

  • content - Optional[str]: the content of the message to send, defaults to None

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 ""
  • 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 ""

Emojis:

  • firstEmoji - Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict]: emoji of the button used to go to the first page, defaults to "⏮️"
  • prevEmoji - Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict]: emoji of the button used to go to the previous page, defaults to "◀"
  • nextEmoji - Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict]: emoji of the button used to go to the next page, defaults to "▶"
  • lastEmoji - Optional[Union[discord.emoji.Emoji, discord.partial_emoji.PartialEmoji, dict]: emoji of the button used to go to the last page, defaults to "⏭️"

Styles (the colo[u]r of the buttons):

  • indexStyle - Optional[Union[ButtonStyle, int]]: the type of button (ButtonStyle or int) for the index button, defaults to 3 (ButtonStyle.green)
  • firstStyle - Optional[Union[ButtonStyle, int]]: the type of button (ButtonStyle or int) for the first button, defaults to 1 (ButtonStyle.blue)
  • prevStyle - Optional[Union[ButtonStyle, int]]: the type of button (ButtonStyle or int) for the previous button, defaults to 1 (ButtonStyle.blue)
  • nextStyle - Optional[Union[ButtonStyle, int]]: the type of button (ButtonStyle or int) for the next button, defaults to 1 (ButtonStyle.blue)
  • lastStyle - Optional[Union[ButtonStyle, int]]: the type of button (ButtonStyle or int) for the last button, defaults to 1 (ButtonStyle.blue)

What to use:

  • useSelect - Optional[bool]: if you want the paginator to use a select, default is True
  • useIndexButton - Optional[bool]: if you want the paginator to use the index button, default is False

Miscellaneous:

  • timeout - Optional[int]: if you want the paginator to work for a limited number of seconds, you can specify it here, defaults to None (meaning no timeout)
  • authorOnly - Optional[bool]: if you want the paginator to work for the author only, default is False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dinteractions_Paginator-1.1.1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

dinteractions_Paginator-1.1.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file dinteractions_Paginator-1.1.1.tar.gz.

File metadata

  • Download URL: dinteractions_Paginator-1.1.1.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for dinteractions_Paginator-1.1.1.tar.gz
Algorithm Hash digest
SHA256 965cdf18ceea5044e20e6ca25a0932231a4f3d3f84aec277466108c185d001b5
MD5 9f4ed4d9d1207306e29ed050ea6bc363
BLAKE2b-256 774284c0bf698d332694b2bb56182afcd1a87af7fc980671712dc30d4317faea

See more details on using hashes here.

File details

Details for the file dinteractions_Paginator-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: dinteractions_Paginator-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for dinteractions_Paginator-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38a9e9069ce018b18f710e2b3300d28c0efa5ac5ada46ff36c9d0e32ac84b1a4
MD5 e30451906f69cdf7097b1eabce177acc
BLAKE2b-256 ea1540e7bb306c9009ef52979e13b7ab5f201574c4f0c4e1b36bf0511f789673

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page