发送消息后崩溃?

Crash after sending a message?

我的 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!');

});

请帮我解决一下,谢谢

您在 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!');
}

});

应该修复它