我正在尝试运行Discord机器人,它说在我尝试运行它时出现“输入意外结束”。这是代码:
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message'), msg => {
if (msg.content === 'ree') {
message.author.kick("FURRY SLUR")
};
client.login('token');
这是错误
SyntaxError: Unexpected end of input
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
答案 0 :(得分:3)
在登录功能之前,您缺少结尾});
。
client.on('message', msg => {
if (msg.content === 'ree' && msg.guild && msg.member.kickable) {
msg.member.kick('FURRY SLUR')
.catch(console.error);
}
});
client.login('token');
答案 1 :(得分:0)
您过早关闭了on
,还没有关闭if
。
client.on('message', msg => {
if (msg.content === 'ree') {
message.author.kick("FURRY SLUR");
}
});