Reputation: 19
I want to make a Wolves/Mafia-esque game on my server. When I write the command !role 1wolf 2villagers
, I would like to randomly distribute the specified roles by private message (so 1 person receives the wolf role and 2 people receive the villager role) to all the people in a specified voice channel.
The roles are not literal guild roles but simply a message.
Upvotes: 0
Views: 5288
Reputation: 3005
You can do it easily:
client.on('message', (message) => {
if(message.content.startsWith('!role')){
let channelID = 'your voice channel id';
message.guild.channels.get(channelID).members.forEach((member) => {
member.send('Your role is villager!');
});
}
});
It will get the voice channels, and for each member, send a message to them.
Upvotes: 1