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.3.tar.gz (2.7 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.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: discordpycomponents-0.2.3.tar.gz
  • Upload date:
  • Size: 2.7 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.3.tar.gz
Algorithm Hash digest
SHA256 5b365fe9cafd5dd6ceb8053dadaf307303b21e0ed2079f2e4b5bbdda2abb5f85
MD5 e1ebab45a6b7b00a98838b760ac26e21
BLAKE2b-256 e5833e5e680aca55bc8d81521a2c7bc85439f7eff0ec566d1335c955d4f559d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for discordpycomponents-0.2.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for discordpycomponents-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4dd652b363601fb9ddfce2b5572e4915e1c0110f12552aebfcad34c2ebc1abc4
MD5 282f82564154bf7b0fb63a0fb0c0f9b3
BLAKE2b-256 9ffa626b883ff31df38431eb8da9f934d921cb9dcba63c1b12c3b5492f94aa43

See more details on using hashes here.

Provenance

The following attestation bundles were made for discordpycomponents-0.2.3-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