上传嵌入图片?
Upload an embed image?
我想知道如何让我的机器人将嵌入的图像上传到 Discord 频道。我知道如何让它发送嵌入,但如何上传嵌入图像? discord.py 甚至可能吗?
请记住,我指的不是您可以在嵌入图片中使用的缩略图,我想知道您是否可以使用 Python 上传嵌入图片。谢谢!
要在嵌入中发送图像,请使用嵌入的 set_image
方法:
e = discord.Embed()
e.set_image(url="https://discordapp.com/assets/e4923594e694a21542a489471ecffa50.svg")
要从您的 PC 发送文件,请使用异步分支中的 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)
我想知道如何让我的机器人将嵌入的图像上传到 Discord 频道。我知道如何让它发送嵌入,但如何上传嵌入图像? discord.py 甚至可能吗? 请记住,我指的不是您可以在嵌入图片中使用的缩略图,我想知道您是否可以使用 Python 上传嵌入图片。谢谢!
要在嵌入中发送图像,请使用嵌入的 set_image
方法:
e = discord.Embed()
e.set_image(url="https://discordapp.com/assets/e4923594e694a21542a489471ecffa50.svg")
要从您的 PC 发送文件,请使用异步分支中的 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)