【问题标题】:Uploading Both an Image And a Thumbnail to a Discord Embed将图像和缩略图上传到 Discord 嵌入
【发布时间】:2022-01-12 19:40:15
【问题描述】:

如何将图像(使用文件)和缩略图(使用 URL)附加到不和谐嵌入?

这是我的脚本:

file = discord.File("cropped.png")
embed.set_image(url = 'attachment://cropped.png')
embed.set_thumbnail(url = icon_URL)
await message.channel.send(file = file, embed = embed)

当机器人发送嵌入时,它只发送图像,而不是同时发送图像和缩略图。这是因为它们是同一个东西,而机器人只能附加一个吗?

【问题讨论】:

    标签: python discord.py bots


    【解决方案1】:

    无论包含什么内容,您都可以发送嵌入和缩略图。 这就是我在嵌入中发送自己的文件的方式。你能分享变量icon_URL 的样子吗?

    file = discord.File("./path/cropped.png", filename="cropped.png")
    embed = discord.Embed(colour=0x5865f2)
    embed.set_image(url="attachment://cropped.png")
    embed.set_thumbnail(url="attachment://cropped.png")
    await message.channel.send(file=file, embed=embed)
    

    【讨论】:

    • 变量icon_URL只是一个普通的图片链接
    猜你喜欢
    • 2020-09-20
    • 2019-04-21
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2021-08-13
    • 1970-01-01
    • 2015-01-05
    • 2010-11-06
    相关资源
    最近更新 更多