discord - 将本地缩略图附加到 Discord Embed
问题描述
我已经尝试了一切,但没有任何工作。如何在 Discord 中附加本地缩略图?图像在图像目录中
味精.py:
embed = discord.Embed(title="Game Started", description=body)
embed.add_field(name=captain1, value=', '.join(team_one), inline=False)
embed.add_field(name=captain2, value=', '.join(team_two))
embed.set_thumbnail(url=f"attachment://images/elite.png")
await ctx.send(embed=embed)
缩略图不显示
解决方案
- 您还必须发送文件
- 中的 url
set_thumbnail
应该只是attachment://{FILENAME}
,没有实际路径,因为它指的是消息的附件
file = discord.File("images/elite.png")
embed = discord.Embed(title="Game Started", description=body)
embed.add_field(name=captain1, value=', '.join(team_one), inline=False)
embed.add_field(name=captain2, value=', '.join(team_two))
embed.set_thumbnail(url=f"attachment://{file.filename}") # you could just do `attachment://elite.png`, but this is a more "procedural" way
await ctx.send(embed=embed, file=file)
推荐阅读
- javascript - 只有第一行中的按钮在使用 javascript 的 html 表中工作
- c# - 过期的accesstoken问题xamarin forms app
- javascript - querySelectorAll 包括自我
- c++ - 将placement new 与存储类一起使用时的额外构造
- javascript - 格式化时间错误 - “10.03”变成“10.3”
- visual-studio-code - VSCode 无法导入 python 库
- mysql - mysql 意外关闭 xampp,在 IP 上创建了套接字:'::' 错误日志
- python - 绘制 spearmanr 相关性的树状图时出错
- bluetooth - 扫描识别蓝牙设备
- python - OTB 是否足以评估随机森林或装袋分类器,或者交叉验证也适用于此?