Skip to main content

Discord Components V2 for discord.py

Project description

py-components

Discord Components V2 for discord.py — a lightweight helper library for building Discord UI components.

Installation

pip install py-components

Requirements

  • Python 3.10+
  • discord.py
  • aiohttp

Usage

from py_components import Button, Text, UI, ButtonStyle

@bot.command()
async def menu(ctx):
    ui = UI(
        Text("Choose an option:"),
        Button("Confirm", custom_id="confirm", style=ButtonStyle.success),
        Button("Cancel", custom_id="cancel", style=ButtonStyle.danger)
    )
    await ui.send(ctx)

Button Styles

Style Colour
ButtonStyle.primary Blue
ButtonStyle.secondary Grey
ButtonStyle.success Green
ButtonStyle.danger Red

View & Callbacks

from py_components import View

view = View()

async def on_click(interaction):
    await interaction.response.send_message("Clicked!")

view.add_button("Click Me", custom_id="btn", callback=on_click)

License

MIT

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

discordpycomponents-0.2.31.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

discordpycomponents-0.2.31-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file discordpycomponents-0.2.31.tar.gz.

File metadata

  • Download URL: discordpycomponents-0.2.31.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for discordpycomponents-0.2.31.tar.gz
Algorithm Hash digest
SHA256 1f487819f7b5d9482cec28efa2e41a1694172c297a95c11f01d59f815ea3294c
MD5 6f1d99084e08b7b168e357c418591a2c
BLAKE2b-256 2acbc4bebf9d7472ccfc370d6af48a171b84f7644f1b995382f4e78c46473f49

See more details on using hashes here.

Provenance

The following attestation bundles were made for discordpycomponents-0.2.31.tar.gz:

Publisher: publish.yml on 2gm49/py-components

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file discordpycomponents-0.2.31-py3-none-any.whl.

File metadata

File hashes

Hashes for discordpycomponents-0.2.31-py3-none-any.whl
Algorithm Hash digest
SHA256 f43e199a0ef5d02957e01c90da8ef3b3895c71b6826e9962e2999a8263473f1b
MD5 f933319a73451d7767b1dae555007fea
BLAKE2b-256 e424643686d182204f4f97a308e614a7f9f3d04524ef446291716b74070f3c3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for discordpycomponents-0.2.31-py3-none-any.whl:

Publisher: publish.yml on 2gm49/py-components

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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