DiscordAPIError:尝试发送嵌入时无效的表单正文 [英] DiscordAPIError: Invalid Form Body when trying to send embeds

查看:22
本文介绍了DiscordAPIError:尝试发送嵌入时无效的表单正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在学习期间编写的第一批命令之一,最近它停止了工作.我稍微摆弄了一下,但看不出问题出在哪里.当我运行 ~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.

这是用户信息的代码:

    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', version, client.user.avatarURL); 改为 .setFooter(`Akasuki ${version}`, client.user.avatarURL);"

完美运行!非常感谢!

这篇关于DiscordAPIError:尝试发送嵌入时无效的表单正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆