From c93ff40647be137cc7f340732790b340e617eb14 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Wed, 28 Apr 2021 09:07:14 -0500 Subject: [PATCH] Allow mentions for user queries --- bot.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bot.js b/bot.js index 35f511d..7f06e4f 100644 --- a/bot.js +++ b/bot.js @@ -479,9 +479,9 @@ async function userInfo(message) { const members = message.guild.members.cache.filter(member => { if (member.nickname) { - return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + 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()) + return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) } }); @@ -638,9 +638,9 @@ async function ban(message) { const members = message.guild.members.cache.filter(member => { if (member.nickname) { - return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + 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()) + return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) } }); @@ -704,9 +704,9 @@ async function kick(message) { const members = message.guild.members.cache.filter(member => { if (member.nickname) { - return member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) || member.nickname.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()); + 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()) + return message.mentions.users.first().id === member.user.id || member.user.username.toLowerCase().includes(message.content.split(" ")[1].toLowerCase()) } });