好吧,我明白了。它的代码如下:
embed = discord.Embed(title="Title", description="Desc", color=0x00ff00) #creates embedfile = discord.File("path/to/image/file.png", filename="image.png")embed.set_image(url="attachment://image.png")await ctx.send(file=file, embed=embed)在 只有 你应该改变的是2号线的地方说:
"path/to/image/file.png"
注意:
第2行和第3行上有一个
image.png。不用担心,因为那就是Discord所谓的上载文件(例如:我有一个名为的文件
duck.png,Discord将其作为上载到其服务器
image.png)。因此,您无需更改
image.png零件。但是,如果您使用特定扩展名很重要的文件,请记住将其更改
image.png为所需的扩展名。需要特定扩展名的文件示例是GIF,因此请记住将其更改
image.png为例如,
image.gif如果您使用的是GIF。
您可以在discord.py的官方文档中了解更多信息:https :
//discordpy.readthedocs.io/en/latest/faq.html#how-do-i-use-a-local-image-
file-for-an-嵌入图像



