discord-components

Discord components are cool, but discord.py will support it on version 2.0. It is hard to wait, so we made a third-party library for using components such as buttons or selects! We're currently developing this library, so it has a lot of bugs. But it has enough features to make the components easy to use :)

Features

  • You can use discord components and handle interactions easily!
  • Methods based on discord.py.
  • Supports discord.ext.commands, and going to support discord-py-slash-command.

Install

pip install --upgrade discord-components

Example

from discord.ext.commands import Bot
from discord_components import DiscordComponents, Button

bot = Bot(command_prefix = "your prefix")


@bot.event
async def on_ready():
    DiscordComponents(bot)
    print(f"Logged in as {bot.user}!")


@bot.command()
async def button(ctx):
    await ctx.send(
        "Hello, World!",
        components = [
            Button(label = "WOW button!")
        ]
    )

    interaction = await bot.wait_for("button_click", check = lambda i: i.component.label.startswith("WOW"))
    await interaction.respond(content = "Button clicked!")


bot.run("your token")

You can see more examples here.

GitHub

https://github.com/devkiki7000/discord.py-components