发送消息后崩溃?

时间:2019-03-08 21:42:24

标签: discord discord.js

我的discord.js机器人可以运行,但是在发送回复后崩溃,为什么?

使用网站上提供的示例,它不起作用

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

client.on('ready', () => {
  console.log(`Bot ready`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('Pong!');

});

请帮我修复它,谢谢

1 个答案:

答案 0 :(得分:0)

在if条件下,您缺少右括号

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

client.on('ready', () => {
  console.log(`Bot ready`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('Pong!');
}

});

应该修复它

相关问题