【问题标题】:Use local file as set_thumbnail on embed in Discord.py使用本地文件作为 set_thumbnail 嵌入 Discord.py
【发布时间】:2021-06-17 20:11:54
【问题描述】:

我想在我的电脑上发布一个带有缩略图的嵌入,以及一个本地文件。 每当我尝试运行此代码时,图像都会在嵌入之外发送。

embedVar = discord.Embed(title="title",
                        description="desc.",
                         color=0X19A6FF)
file = discord.File("file_location/file.png", filename="image.png")
embedVar.set_thumbnail(url="attachment://file_location/file.png")
await message.channel.send(file=file, embed=embedVar)

【问题讨论】:

    标签: python image discord discord.py embed


    【解决方案1】:

    File 构造函数中的文件名和URL 中的文件名必须匹配。目前您正在传递整个路径,它应该只是名称

    embedVar.set_thumbnail(url="attachment://image.png")
    

    【讨论】:

      猜你喜欢
      • 2021-12-07
      • 2020-08-18
      • 1970-01-01
      • 2021-10-26
      • 2020-12-24
      • 2018-07-09
      • 2021-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多