if (message.channel.type === "dm") return message.channel.send("I don't work in DM's"); { if (message.author.Client) return; };
机器人将垃圾邮件重复"我不工作在DM";我不知道这段代码有什么问题。
这里有一张图片来展示如果我给bot写一个DM会发生什么
User.Client
不是属性(见这里)。它是undefined,返回false并且不返回。使用User.bot
代替
if (message.author.bot) return;
if (message.channel.type === "dm") {
return message.channel.send("I don't work in DM's");
}