Discord.js语法错误:意外标记“.”
我收到这个错误
.addField("Among Us related commands",
^
SyntaxError: Unexpected token '.'
使用帮助命令时,我正在查看有关命令的哪些视图信息 我试图检查我的代码有什么问题,但没有发现任何问题,请帮忙
.addField("Among Us related commands",
^
SyntaxError: Unexpected token '.'
回答
使用函数链接,您需要删除函数之间的分号:
const embed = new Discord.MessageEmbed()
// ...
.setTimestamp(); // ; needs to be removed
.setFooter(message.member.user.tag, message.author.avatarURL());
最后结果:
const embed = new Discord.MessageEmbed()
.setAuthor(`My prefix here is ${prefix}nuse ${prefix}help <command name> to get info about a command`)
.addField("Among Us related commands", "tips")
.addField("Among Us Mini Game", "soon")
.addField("Utility commands", "ping")
.setColor('GREEN')
.setTimestamp()
.setFooter(message.member.user.tag, message.author.avatarURL());