DiscordAPIError:尝试发送嵌入内容时表单主体无效 [英] DiscordAPIError: Invalid Form Body when trying to send embeds
问题描述
这是我在学习时编写的第一批命令之一,最近它停止了工作.我稍微摆弄了一下,但是看不出问题的根源.当我运行〜userinfo
时,控制台中出现以下错误:
This is one of the first commands I wrote whilst I've been learning, and recently it stopped working. I fiddled with it a little, but can't see where the problem comes from. When I run ~userinfo
the following error comes up in the console:
Unhandled Rejection at: DiscordAPIError: Invalid Form Body
embed.footer.icon_url: Not a well formed URL.
这是userinfo的代码:
This is the code for userinfo:
if (command === 'userinfo') {
var embed = new Discord.RichEmbed()
.setTitle('User Info')
.addField('Username', message.author.tag)
.addField('Server', message.guild.name)
.setColor(0xFF8AFF)
.setThumbnail(message.author.avatarURL)
.setFooter('Akasuki', version, client.user.avatarURL);
message.channel.send(embed);
}
将 message.channel.send()
更改为 message.channel.sendEmbed()
会引发错误,并且使用 send()并没有错.
到目前为止.
Changing message.channel.send()
to message.channel.sendEmbed()
brings up errors, and there's been nothing wrong with using send()
so far.
此外,这不是必需的,但是如果有人知道如何在创建用户帐户时进行添加,则对该嵌入很有帮助.甚至是资源还是夫妻?感谢您的阅读.
Also, this isn't necessary but if anyone knows how to add when the users account was created, to this embed it would be very helpful. Or even a resource or couple? Thanks for reading.
推荐答案
使用了Cursed的解决方案(在注释中):
Used Cursed's solution (in comments):
将 .setFooter('Akasuki',版本,client.user.avatarURL);
更改为 .setFooter(`Akasuki $ {version}`,client.user.avatarURL);
"
完美运行!非常感谢!
这篇关于DiscordAPIError:尝试发送嵌入内容时表单主体无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!