DiscordAPIError: Invalid Form Body when trying to send embeds

流过昼夜 提交于 2020-12-15 05:15:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!