[Solved] how do i send a private message to all people who have a certain role? (discord.js) [closed]


You can use the Role.members property.

// get role by name
const role = message.guild.roles.cache.find(role => role.name === '<roleName>');

// send a message to everyone with the role
role.members.each(user => user.send('This is a DM'));

This method assumes you have a way to get the <roleName> value from a string; perhaps with an args variable.

solved how do i send a private message to all people who have a certain role? (discord.js) [closed]