Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from discord_components import DiscordComponents, Button, ButtonStyle
- bot = commands.Bot(command_prefix=".", intents=discord.Intents.all())
- @bot.event
- async def on_ready():
- DiscordComponents(bot)
- @bot.command()
- async def test(ctx):
- await ctx.send(embed=discord.Embed(title="Invite to party"),
- components=[
- [
- Button(style=ButtonStyle.green, label="Accept", emoji="π₯"),
- Button(style=ButtonStyle.red, label="Decline", emoji="πΉ"),
- Button(style=ButtonStyle.red, label="I'll think...", emoji="π€")
- ],
- [
- Button(style=ButtonStyle.URL, url="https://youtube.com/c/Π€ΡΠΎΠΊΠΈ", label="YouTube")
- ]
- ]
- )
- response = await bot.wait_for("button_click")
- if response.channel == ctx.channel:
- if response.component.label == "Accept":
- await response.respond(content="Great! π₯°")
- else:
- await response.respond(embed=discord.Embed(title="Are you sure?"),
- components=[
- [
- Button(style=ButtonStyle.green, label="YES"),
- Button(style=ButtonStyle.red, label="NO")
- ]
- ]
- )
- bot.run("TOKEN")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement