您好,我想将DM发送给具有特定角色的用户,
我尝试过此代码无效。 :
const args = message.content.split(" ");
const roleArgs = args.slice(0, 1);
const messageArgs = args.slice(1)
const role = message.guild.roles.find(role => role.name.toLowerCase() === roleArgs.join(" ").toLowerCase())
if (!role) return message.reply('There is not such a role!');
for (let i = 0; i < message.guild.members.size; i++) {
if (message.guild.members[i].roles.has(role.id)) {
message.guild.members[i].user.send(messageArgs.join(" "))
}
}
!dm @role(消息)