我一直在尝试广播功能,但是当我尝试使用它只是垃圾邮件(出于某种原因仅是我的收件箱)时,无论如何要防止这种情况发生? (我是JavaScript新手)
module.exports = {
name: "dmall",
description: "Broadcast",
run: async (client, message, args) => {
message.delete();
if (message.author.id === "294835623028588546") {
message.guild.members.cache.forEach((member) => {
var DM = args;
message.member.send(DM);
});
}
},
};
答案 0 :(得分:0)
您有message.member
,因此它提到了您。您应该使用member
,而不是message.member
。在下面的代码中,我对其进行了修复。
name: "dmall",
description: "Broadcast",
run: async (client, message, args) => {
message.delete();
if (message.author.id === "294835623028588546") {
message.guild.members.cache.forEach((member) => {
var DM = args;
member.send(DM);
});
}
},
};```