[英]Problem with discord.py (how can I send an ephemeral message with embed table)
用户按下按钮,discord 机器人向他发送角色表,但我只能使用带有短暂消息的文本
response = await self.client.wait_for('button_click', check = lambda message: message.author == ctx.author)
if response.component.custom_id == 'bth_roles_info':
await response.respond(content = 'Action one')
elif response.component.custom_id == 'bth_booster_perks':
await response.respond(content = 'Action two')
elif response.component.custom_id == 'bth_server_rules':
await response.respond(content = 'Action three')
如何向此代码添加嵌入消息?
如果我正确理解了这个问题,那么您正在寻找构建一个嵌入并临时发送它。 资源: https://discordpy.readthedocs.io/en/stable/api.html#embed
这是创建嵌入的方法:
embed = discord.Embed(title="This is your Embed Title",
description="This is your description",
color=discord.Colour.random())
然后,当您想稍后使用您的嵌入并发送它时,您可以将您的响应命令更新为:
await response.respond(content = 'Action three', embed=embed, ephemeral=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.