如何使我的discord机器人自动响应任何消息

如何使我的discord机器人自动响应任何消息,discord,discord.js,Discord,Discord.js,我想做的是设置一个自动响应discord bot,在特定的通道中为正在发送的任何消息添加一个响应。我不明白为什么它没有显示在discord中。这很简单,只需添加一个消息事件侦听器,验证通道id是否是您想要的,然后使用该方法。例如: client.on('message', message => { if (message.channel.id !== 'channel id here') return; message.react('emoji here') // if you w

我想做的是设置一个自动响应discord bot,在特定的通道中为正在发送的任何消息添加一个响应。我不明白为什么它没有显示在discord中。

这很简单,只需添加一个消息事件侦听器,验证通道id是否是您想要的,然后使用该方法。例如:

client.on('message', message => {
  if (message.channel.id !== 'channel id here') return;
  message.react('emoji here')
// if you want to use a custom emoji put it's id there instead.
})

如果你不提供代码我们就帮不了你谢谢japanballdev帮了很多忙