Browse Source

Add role querys and add participants.csv to .gitignore

master
Abheek Dhawan 4 years ago
parent
commit
d9fca4cb8f
  1. 1
      .gitignore
  2. 11
      index.js

1
.gitignore

@ -1 +1,2 @@
node_modules/
participants.csv

11
index.js

@ -44,10 +44,15 @@ client.on("message", async message => {
async function usersWithRole(message) {
if (message.content.split(" ")[1].length < 3) {
message.reply("query must contain at least 3 characters!")
return;
}
const roles = message.guild.roles.cache.filter(role => role.name.includes(message.content.split(" ")[1]));
console.log(message.content.split(" ")[1]);
console.log(roles);
const roles = message.guild.roles.cache.filter(role => role.name.toLowerCase().includes(message.content.split(" ")[1]));
const roleEmbed = new Discord.MessageEmbed()
.setTitle(`${roles.array()[0].members.array().length} users with the role \`${roles.array()[0].name}\`:`)
.setDescription(" • " + roles.array()[0].members.map(m => m.user.tag).join('\n\n • '))
.setFooter(`Role ID: ${roles.array()[0].id}`)
.setTimestamp();
message.channel.send(roleEmbed);
}
async function aboutServer(message) {

Loading…
Cancel
Save