【问题标题】:Multiple photos in discord.py embeddiscord.py 中嵌入多张照片
【发布时间】:2020-07-26 13:00:52
【问题描述】:

好的,我有两张图表图像,我想将它们发送到一个嵌入消息中: 这是我写的代码:

 charts = [
            discord.File("/root/discord.py/chart-render/tempchart.png", filename="tempchart.png"),
            discord.File("/root/discord.py/chart-render/ramchart.png", filename="ramchart.png")
            ]
            stats.set_image(url="attachment://tempchart.png")
            stats.set_image(url="attachment://ramchart.png")
            await ctx.send(embed=stats, files=charts)

问题是一个在嵌入中发送,但第二个没有 - 它通过嵌入消息发送

我该如何解决这个问题?

【问题讨论】:

    标签: python-3.x embed discord.py discord.py-rewrite


    【解决方案1】:

    我已经链接了一张图片,希望可以帮助您更好地了解嵌入的工作原理,因此基本上每个嵌入只能有 1 张图片,很遗憾,您需要发送两张嵌入。此外,here 是一个不错的在线嵌入可视化工具。

    希望对你有帮助

    【讨论】:

    • 好的,我会发送两个嵌入文件
    【解决方案2】:

    所以基本上是为了简化@Ethan M-H 的回答。 这是如何在一个嵌入discord.py中发送3个图像 https://discord.com/channels/336642139381301249/381965515721146390/739465676586221628

    embedVar = discord.Embed(title=f'title', description=f'description', color=0xffd800)
    embedVar.set_image(url="https://cdn.discordapp.com/attachments/84319995256905728/252292324967710721/embed.png")    #the image itself
    embedVar.set_footer(text='footer',icon_url="https://cdn.discordapp.com/attachments/84319995256905728/252292324967710721/embed.png")   #image in icon_url
    embedVar.set_thumbnail(url="https://cdn.discordapp.com/attachments/84319995256905728/252292324967710721/embed.png") #image itself
    
    

    考虑阅读这篇文章:https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed :) 并考虑加入官方 discord.py 服务器以提出更多问题 https://discord.gg/dpy(因为您编写了 discord 代码,所以您应该有一个 discord 帐户 :))

    希望我提供了一个很好的答案。玩得开心编码!

    我是堆栈溢出的新手,这里的答案基于https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed,尚未经过测试。请评论我需要纠正的地方。 此外,除非您需要两张 BIG 图片,否则无需发布两个嵌入。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多