语法错误:意外的标识符(MAC)

时间:2020-08-15 16:26:23

标签: javascript node.js syntax-error discord.js

运行代码时,我不断收到SyntaxError: Unexpected identifier。有人知道如何解决吗?

代码:

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('message', msg => {
  if (msg.content === 'help') {
    msg.reply('I dont want to help you now! go ask somebody else!');
}

bot.user.setStatus('available')
  bot.user.setPresence({
      game: {
          name: Made by sorryIwonbtwYT for TheSinni',
          type: "WATCHING",
      }
  });
});

1 个答案:

答案 0 :(得分:0)

好像您在setPresence附近缺少一个'

这应该解决您的代码:

const Discord = require('discord.js');
const client = new Discord.Client();

client.on("ready", () => {
client.user.setPresence({ game: { name: 'Made by sorryIwonbtwYT for TheSinni', type: 'WATCHING' }, status: 'online'  })       
})

client.on('message', msg => {
  if (msg.content === 'help') {
    msg.reply('I dont want to help you now! go ask somebody else!');
}
});

client.login('YOUR_TOKEN')