我用这段代码嵌入了一个图像,它没有抛出任何错误,它发送了一个嵌入,但嵌入中什么都没有。
e=discord.Embed()
file = discord.File("OWO.jpg", filename="OWO.jpg")
e.set_thumbnail(url="attachment://OWO.jpg")
msg = ctx.send(embed=e)这是my embed image看起来,里面什么都没有。
发布于 2021-08-26 16:58:02
您还需要发送该文件
msg = await ctx.send(embed=e, file=file)发布于 2021-08-26 19:55:28
embed = discord.Embed()
file = discord.File("path/to/my/image.png", filename="image.png")
embed.set_image(url="attachment://image.png")
msg = await ctx.send(file=file, embed=embed)发布于 2021-08-26 20:47:01
如何将本地图像文件用于嵌入图像?
不一致的特殊情况-上传图像附件并在嵌入中使用它,以便它不会单独显示,而是在嵌入的缩略图、图像、页脚或作者图标中显示。
为此,通常使用abc.Messageable.send()上传图像,并将嵌入的图像URL设置为attachment:// image.png,其中image.png是要发送的图像的文件名。
快速示例:
file = discord.File("path/to/my/image.png", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await channel.send(file=file, embed=embed)注意:由于不一致的限制,文件名可能不包含下划线。
是否存在正在创建的审核日志条目的事件?
https://stackoverflow.com/questions/68942255
复制相似问题