【发布时间】:2020-07-11 22:06:45
【问题描述】:
msg = discord.Embed(
title = country_name + ' Coronavirus cases',
colour = discord.Colour.blue(),
)
msg.set_thumbnail(url='https://www.worldometers.info/img/flags/'+ country_code +'-flag.gif')
msg.add_field(name='**Total Cases**', value = total_cases, inline = False)
msg.add_field(name='**Deaths**', value = total_deaths, inline = False)
msg.add_field(name='**Recovered**', value = total_recovered, inline = False)
await message.channel.send(embed=msg)
错误:
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.fields.1.value: This field is required
我收到了错误,查了一下,上面写着“当字符超过 2000 个时会发生这种情况”,我的消息少于 100 个。我的代码从网站抓取数据并通过在不和谐中嵌入消息。任何帮助或建议都会有所帮助。
【问题讨论】:
-
错误是
Invalid Form Body。 discordapp.com/developers/docs/topics/…这与“超过2000个字符”无关。我怀疑您使用的是非常旧的 discord.py 库版本。请python -m pip freeze告诉我们您的版本 -
`discord==1.0.1 discord.py==1.2.5
-
卸载
discord==1.0.1python -m pip uninstall discord并重试 -
我仍然遇到和以前一样的错误。
-
embed.fields.1.value: This field is required确保该值为字符串。
标签: python discord.py