Skip to content

PythonSerious/discord.py-components

 
 

Repository files navigation

discord.py-components

Build Status PyPI version Documentation Status

unofficial library for discord components(on development)

Install

pip install --upgrade discord-components

Example

from discord import Client
from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType

bot = Client()
ddb = DiscordComponents(bot)

@bot.event
async def on_message(msg):
    if msg.author.bot:
        return

    await msg.channel.send(
        "Content",
        components=[
            Button(style=ButtonStyle.blue, label="Blue"),
            Button(style=ButtonStyle.red, label="Red"),
            Button(style=ButtonStyle.URL, label="url", url="https://example.org"),
        ],
    )

    res = await bot.wait_for("button_click")
    if res.channel == msg.channel:
        await res.respond(
            type=InteractionType.ChannelMessageWithSource,
            content=f'{res.component.label} clicked'
        )


bot.run("token")

Docs

The docs can contain lot of spelling mistakes, grammar errors so if there is a problem please create an issue!

Features

  • Send, Edit discord components
  • Get components interact event!
  • Supports discord.ext.commands

Helps

  • Minibox - Button API explanation
  • Lapis - Told me how to replace a property

About

unofficial library for discord components(on development)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%