From 01f6e79cf3d422ebfe8cbe9c06a47613a651c805 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Fri, 2 Apr 2021 22:03:19 -0500 Subject: [PATCH] Use correct array index in case of nickname --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4efe0e6..cb20877 100644 --- a/index.js +++ b/index.js @@ -148,7 +148,7 @@ async function addRole(message) { const members = message.guild.members.cache.filter(member => { if (member.nickname) { - return member.user.username.toLowerCase().includes(message.content.split(" ")[2].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + return member.user.username.toLowerCase().includes(message.content.split(" ")[2].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[2].toLowerCase()); } else { return member.user.username.toLowerCase().includes(message.content.split(" ")[2].toLowerCase()) }