“未定义m” discord.js messagecollector

时间:2019-03-08 17:33:33

标签: javascript node.js discord discord.js

我正试图制作一个不和谐的收藏家:

let user = message.author;
let guest = message.mentions.users.first()

const collector = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id || m.author.id === guest.id, {
  time: 60000,
  max: 100,
  maxMatches: 100
});

collector.on('collect', message => {
  if (message.content == "a" && m.author.id === message.author.id) {
    message.channel.send("b")
  } else if (message.content == "a" && m.author.id === guest.id) {
    message.channel.send("c")
  }
})

USER 编写此命令(prefix + command + @guest)并说“ a”时,机器人将以“ b”回复,如果 GUEST 说“机器人会回复“ c”。

问题是m没有定义,我该如何解决?

1 个答案:

答案 0 :(得分:0)

您需要更改此内容

collector.on('collect', message => {...});

对此:

collector.on('collect', m => {...});

然后message是原始邮件,m是收集的邮件。