From 6533e5a885d2f2e72445a60049645bb4d4fad359 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Fri, 14 May 2021 08:10:03 -0500 Subject: [PATCH] Fix usersWith character limit --- bot.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bot.js b/bot.js index bd97f01..6d5a686 100644 --- a/bot.js +++ b/bot.js @@ -789,9 +789,17 @@ async function kick(message) { const members = message.guild.members.cache.filter(member => { if (member.nickname) { - return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + if (message.mentions.users.first()) { + return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + } else { + return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + } } else { - return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) + if (message.mentions.users.first()) { + return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) + } else { + return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + } } });