[英]discord.py how to add an image to embed.add_field
如何在embed.add_field(name=f'Last Match ({status})', value=
的值中添加本地图像
file = discord.File(f"{icon_full_path}", filename=f"{icon_png}")
embed = discord.Embed(title=f'**{name}**', description=f'Summoner Level: {level}')
embed.set_thumbnail(url=f'attachment://{icon_png}')
embed.add_field(name='Ranked (Solo/Duo)', value=f'{full_rank}')
embed.add_field(name=f'Last Match ({status})', value=f'{kills} / {deaths} / {assists} \n {minions}<:minion:823209384908816404> \t {gold}<:gold:823209384942370836>')
await ctx.send(file=file, embed=embed)
我们不能在add_field
的值字段中添加图像。 discord.Embed class的所有功能请参考discord.Embed。
我们使用set_image
设置图像(大尺寸)和set_thumbnail
将图像设置到嵌入的右上角(如徽标)。
根据您的使用情况,您可以使用其中任何一个。
如果要嵌入本地图像,可以参考 discord py api 上的此页面。
使用 add_image 添加图片
embed = discord.Embed(title = 'hi', description = 'cheese',color = discord.Colour.blue())
embed.add_image(url = 'insert random url here')
await message.channel.send(embed=embed)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.