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
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
pycordviews-1.1.3.tar.gz
(10.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycordviews-1.1.3.tar.gz.
File metadata
- Download URL: pycordviews-1.1.3.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c706b658fe357c9e8285d4b68b8ea8e5f17edfc5814919033b16f72f91c07e8
|
|
| MD5 |
f0a69bdc0338f640870a22e3e5d62b83
|
|
| BLAKE2b-256 |
485d39f06e7c90fa36a53db701a71b8ed2f22364631687c6018cdb69fb2bcb02
|
File details
Details for the file PycordViews-1.1.3-py3-none-any.whl.
File metadata
- Download URL: PycordViews-1.1.3-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df0ff9e14755e2e0810788259abd2f2066d04792e6027bc8f96caa58bc38db4e
|
|
| MD5 |
59f93c94bc50d3a662a7b2d724ea8ea9
|
|
| BLAKE2b-256 |
e0951ccc62e7933c4c142c1a5757ab8d26a574288cb7db1fb318d04b2164e01d
|