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.

DISCLAIMER: THIS IS NOT COMPLETED AND LACKS FEATURES AND HAS BUGS.

PyPi: https://pypi.org/project/DiscordPYComponents/

Installation

pip install DiscordPYComponents

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.33.tar.gz (3.0 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.33-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: discordpycomponents-0.2.33.tar.gz
  • Upload date:
  • Size: 3.0 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.33.tar.gz
Algorithm Hash digest
SHA256 686dac32efcc57a55f67c91ca55fbf8d956d176ebc0d3298bec0ec632a81eb1e
MD5 4a8ec9acac79f69cd7aee8050f5961c4
BLAKE2b-256 41ade5c2a2f7d4881ed3a35d1ccc2f5c210e9a533402d4c003432b05033f62c0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for discordpycomponents-0.2.33-py3-none-any.whl
Algorithm Hash digest
SHA256 68e7bdf23072d2def715c5f09e14df4076c62674f58d62c2286f16ff61090e99
MD5 bb858ab57bae4fe231823b534b1593d8
BLAKE2b-256 8315a00a082ddcbedf0aca5193cd6da02c7e6ab60dc98b7d50bd1a0ee6f16968

See more details on using hashes here.

Provenance

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