我想知道如何让我的机器人上传嵌入图像成为Discord频道。我知道如何让它发送嵌入消息,但我如何上传嵌入图像?甚至可以使用discord.py吗?请记住,我不是指嵌入图像中可以包含的缩略图,我想知道您是否可以使用Python上传嵌入图像。谢谢!
要在嵌入中发送图像,请使用嵌入的set_image
方法:
e = discord.Embed()
e.set_image(url="https://discordapp.com/assets/e4923594e694a21542a489471ecffa50.svg")
要从PC发送文件,请在async分支中使用send_file
方法,或在重写分支中使用send
方法。
# Async
await bot.send_file(channel, "filepath.png", content="...", filename="...")
# Rewrite
file = discord.File("filepath.png", filename="...")
await channel.send("content", file=file)