Skip to main content

Views for py-cord library

Project description

Py-cord_Views

Views for py-cord library

from pycordViews.pagination import Pagination
from pycordViews.menu import SelectMenu
import discord

intents = discord.Intents.all()
bot = discord.AutoShardedBot(intents=intents)

@bot.command(name="My command paginator", description="...")
async def pagination_command(ctx):
    """
    Create a command pagination
    """
    pages: Pagination = Pagination(timeout=None, disabled_on_timeout=False)
    
    pages.add_page(content="It's my first page !!", embed=None)# reset embed else he show the embed of the page after
    
    embed = discord.Embed(title="My embed title", description="..........")
    pages.add_page(content=None, embed=embed) # reset content else he show the content of the page before

    pages.add_page(content="My last page !", embed=None)# reset embed else he show the embed of the page before

    await pages.respond(ctx=ctx) # respond to the command
    await pages.send(send_to=ctx.author) # send the message to the command author
    
@bot.command(name="My command select")
async def select_command(ctx):
    """
    Create a command select
    """
    async def your_response(select, interaction):
        await interaction.response.send(f"You have selected {select.values[0]} !")
    
    my_selector = SelectMenu(timeout=None, disabled_on_timeout=False) # A basic selector menu
    my_menu = my_selector.add_string_select_menu(placeholder="Choice anything !") # add string_select UI
    
    my_menu.add_option(label="My first choice !", emoji="😊", default=True, description="It's the first choice !", value='first choice')
    my_menu.add_option(label="My second choice !", value='second choice')
    my_menu.set_callable(your_response)
    
    await my_selector.respond(ctx)
    
bot.run("Your token")

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

pycordviews-1.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PycordViews-1.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file pycordviews-1.1.0.tar.gz.

File metadata

  • Download URL: pycordviews-1.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.4

File hashes

Hashes for pycordviews-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fd28dd2b40c6a8476c93b0442e66656332d92daef1a2ba3196d67951894363d6
MD5 f79e85762b2960dd4a4f21f3cca2b572
BLAKE2b-256 e74a03126d7c6cc4eac63b9c74255c1ae348616c8e93615528ba1e72f533e561

See more details on using hashes here.

File details

Details for the file PycordViews-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: PycordViews-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.4

File hashes

Hashes for PycordViews-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1b564213570403a984e236aa6abc37ae40591f85bc381b1db823b7f334d7f31
MD5 abd6c2737dc1e4cf699626294db73255
BLAKE2b-256 526dc6497fdecab71aadf81080a36ee40e778a62add1bfd09cdbd4304600d0df

See more details on using hashes here.

Supported by

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