Reputation: 37
I wanted to know how to add buttons to Rich Embed Messages for my Discord bot in Discord.py Like this: Example
Upvotes: 1
Views: 6726
Reputation: 11
I useing the buttons in discord too, because they are nice. I also had a problem like this and I finaly use this code:
ticket = await channel.send(
"_ _",
components = [
Button(label = "YOUR NAME", style=ButtonStyle.blue, emoji="📬"),
]
)
await client.wait_for("button_click", check = lambda i: i.component.label.startswith("YOUR NAME"))
await test.respond(content="hello")
So this is my Code. You dont have to use a emoji in front but I think its nice.
Upvotes: 1
Reputation:
You can add a emoji with the Text and add a reaction to the Embed.
for example:
if message.content.startswith(begin + "help"):
embed = discord.Embed(title='{} Needs Help'.format(message.author),
description='Help for {}'.format(client.user.name),
color=message.author.color)
embed.add_field(name="Title", value='description', inline=True)
embed.set_footer(text="Bot by orty")
embed.set_thumbnail(url=message.author.avatar_url)
msg = await message.channel.send(embed=embed)
await msg.add_reaction(client.get_emoji('Custom Emoji ID'))
Upvotes: 1
Reputation: 306
This feature is not implemented yet in Discord.py, it will be for the 2.0 (this is what is planned for the moment), but there is already few libs that make it. A good one is that of kiki700, Discord-Components
Upvotes: 1