From 7543dd5165da529bb2a60f3b768711f4890b0476 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Fri, 2 Apr 2021 18:16:01 -0500 Subject: [PATCH] Fix order of return functions in roleRequest --- index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index cdd3fee..0228061 100644 --- a/index.js +++ b/index.js @@ -98,9 +98,15 @@ client.on("message", async message => { roleRequest(message); } else if (message.content.toLowerCase().startsWith(`${prefix}userswithrole`)) { usersWithRole(message); + } else if (message.content.toLowerCase().startsWith(`${prefix}ban`)) { + ban(message); } }); +async function ban() { + +} + async function helpMessage(message) { const helpEmbed = new Discord.MessageEmbed() .setTitle(`Helping \`${message.author.tag}\``) @@ -162,8 +168,6 @@ async function aboutServer(message) { } async function roleRequest(message) { - const roles = message.guild.roles.cache.filter(role => role.name.toLowerCase().includes(message.content.split(" ")[1])); - let roleChannel; if (!message.content.split(" ")[1]) { message.reply("query must contain at least 3 characters!") @@ -175,6 +179,9 @@ async function roleRequest(message) { return; } + const roles = message.guild.roles.cache.filter(role => role.name.toLowerCase().includes(message.content.split(" ")[1])); + let roleChannel; + if (roles.array().length < 1) { message.reply("no roles found with that name!"); return;