想读取特定频道的消息时出错

Error when wanting to read the messages of a specific channel

我正在尝试"moderate"一个频道,在这个频道中应该只能发送某些命令,当他们发送的命令或消息与允许的不同时,我会发送一条消息警告它。我有条件的适度逻辑,但我的问题是我无法获得在该频道上发送的消息(在该特定频道上写的任何人)

执行代码时,它没有在控制台中显示任何内容,这意味着它无法识别他们在该频道中发送的消息:(

代码:

client.on("message", (message) => {
  if (message.author.tag === "NAME#1234") {
    if (message.content.startsWith(prefix + "on")) {
      console.log(message.channel.id)
      if (message.channel.id == "361344824500289538") {
        //If the channel where they send the message has the id that I have set, then show me the messages that are sent
        console.log(message.content)
      } else {
        console.log(message.content)
      }
    }
  }
});

假设您希望一个命令仅在一个频道中使用(对于名为“memes”的频道,这可能是 /meme)。如果在别处使用该命令,机器人会说“此处不允许使用命令!”

这是代码:

client.on("message", message => {
     if (message.content.startsWith('/meme') {
         if (message.channels.find(c => c.name ===! 'memes') {
              message.reply("Command Not Allowed Here!")
        } else {rest of meme command script}
     }
}