问题
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.
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);
}
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.
回答1:
Used Cursed's solution (in comments):
"Change .setFooter('Akasuki', version, client.user.avatarURL);
to .setFooter(`Akasuki ${version}`, client.user.avatarURL);
"
Works perfectly! Thank you so much!
来源:https://stackoverflow.com/questions/58876034/discordapierror-invalid-form-body-when-trying-to-send-embeds