From 6f5e2527a4b198c3be208d3bc97e40af35ad4158 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Thu, 1 Apr 2021 17:28:54 -0500 Subject: [PATCH] Test roles functionality --- index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.js b/index.js index 0f617c1..0d6bd68 100644 --- a/index.js +++ b/index.js @@ -36,9 +36,21 @@ client.on("message", async message => { bulkDelete(message); } else if (message.content.toLowerCase().startsWith("$rolerequest")) { roleRequest(message); + } else if (message.content.toLowerCase().startsWith("$userswithrole")) { + usersWithRole(message); } }); +async function usersWithRole(message) { + if (message.content.split(" ")[1].length < 3) { + message.reply("Query must contain at least 3 characters!") + } + const roles = guild.roles.cache.filter(role => role.name.includes(message.content.split(" ")[1])); + console.log(message.content.split(" ")[1]); + console.log(roles); + message.reply(roles); +} + async function aboutServer(message) { const textChannelCount = message.guild.channels.cache.filter(c => c.type === 'text').size; const voiceChannelCount = message.guild.channels.cache.filter(c => c.type === 'voice').size;