discord.py 嵌入多张照片
Multiple photos in discord.py embed
好的,我有两张图表图片,我想在一条嵌入消息中发送它们:
这是我写的代码:
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)
问题是第一个发送嵌入消息,但第二个不发送 - 它发送嵌入消息
我该如何解决这个问题?
我已经链接了一张图片,希望可以帮助您更好地理解嵌入的工作原理,因此基本上每个嵌入只能有一张图片,不幸的是,您需要发送两个嵌入。此外,here 是一个不错的在线嵌入可视化工具。
希望对您有所帮助
所以基本上是为了简化 @Ethan M-H
的回答。
这是如何在一个嵌入中发送 3 张图像 discord.py
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 :) and also consider joining the official discord.py server to ask more questions https://discord.gg/dpy(既然你编写了 discord,你应该有一个 discord 帐户 :))
希望我提供了一个很好的答案。祝您编码愉快!
我是堆栈溢出的新手,这里的答案是基于https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed,还没有经过测试。请评论我需要更正的地方。
此外,除非您需要两个大图像,否则不需要 post 两个嵌入。
好的,我有两张图表图片,我想在一条嵌入消息中发送它们: 这是我写的代码:
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)
问题是第一个发送嵌入消息,但第二个不发送 - 它发送嵌入消息
我该如何解决这个问题?
我已经链接了一张图片,希望可以帮助您更好地理解嵌入的工作原理,因此基本上每个嵌入只能有一张图片,不幸的是,您需要发送两个嵌入。此外,here 是一个不错的在线嵌入可视化工具。
希望对您有所帮助
所以基本上是为了简化 @Ethan M-H
的回答。
这是如何在一个嵌入中发送 3 张图像 discord.py
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 :) and also consider joining the official discord.py server to ask more questions https://discord.gg/dpy(既然你编写了 discord,你应该有一个 discord 帐户 :))
希望我提供了一个很好的答案。祝您编码愉快!
我是堆栈溢出的新手,这里的答案是基于https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed,还没有经过测试。请评论我需要更正的地方。 此外,除非您需要两个大图像,否则不需要 post 两个嵌入。