【发布时间】:2019-07-06 14:42:35
【问题描述】:
我正在尝试“调节”一个频道,在这个频道中应该只能发送某些命令,当他们发送与允许的命令或消息不同的命令或消息时,我会发送一条消息警告它。我有条件的审核逻辑,但我的问题是我无法获得在该频道上发送的消息(在该特定频道上写作的任何人)
执行代码时,它在控制台中没有显示任何内容,这意味着它无法识别他们在该通道中发送的消息:(
代码:
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)
}
}
}
});
【问题讨论】:
-
我建议为每个
if语句创建一个else语句来检查代码中哪里出错了。尝试从那里修复它,如果您遇到新问题,请告诉我们
标签: javascript node.js discord.js