【发布时间】:2021-08-16 10:17:12
【问题描述】:
我想知道如何在 Discord.py 中为我的 Discord 机器人添加丰富的嵌入消息按钮 像这样: Example
【问题讨论】:
-
我在 Discord 的 3 年里从未见过这样的事情。
-
他们是2-3天前介绍的@TreeBen77
标签: python discord.py
我想知道如何在 Discord.py 中为我的 Discord 机器人添加丰富的嵌入消息按钮 像这样: Example
【问题讨论】:
标签: python discord.py
您可以在文本中添加表情符号并向嵌入添加反应。
例如:
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'))
【讨论】:
此功能尚未在 Discord.py 中实现,它将用于 2.0(这是目前计划的),但已经很少有库可以实现它。 A good one is that of kiki700, Discord-Components
【讨论】:
我也使用不和谐的按钮,因为它们很好。 我也遇到了这样的问题,我最终使用了这段代码:
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")
所以这是我的代码。您不必在前面使用表情符号,但我认为它很好。
【讨论】: