From 784bb76fc96b5d30e5e5df85c999f0bcfaf5b46f Mon Sep 17 00:00:00 2001 From: Null Date: Tue, 14 Apr 2020 23:19:54 -0500 Subject: [PATCH] fix(src/class/Util.ts): Make mentions resolve --- src/class/Util.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/class/Util.ts b/src/class/Util.ts index 23f59ed..2bfcc78 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -49,7 +49,8 @@ export default class Util { public resolveMember(message: Message, search: string, guild: Guild): Member | undefined { try { - let member = guild.members.find((mem) => `${mem.user.username}#${mem.user.discriminator}` === search || mem.user.id === search || mem.user.username === search || mem.user.username.startsWith(search) || mem.user.username.toLowerCase() === search.toLowerCase() || mem.user.username.toLowerCase().startsWith(search.toLowerCase())); + // Name, Mention, or ID + let member = guild.members.find((mem) => mem.user.id === message.mentions[0].id || `${mem.user.username}#${mem.user.discriminator}` === search || mem.user.id === search || mem.user.username === search || mem.user.username.startsWith(search) || mem.user.username.toLowerCase() === search.toLowerCase() || mem.user.username.toLowerCase().startsWith(search.toLowerCase())); // Nickname // eslint-disable-next-line no-mixed-operators if (!member) { @@ -59,7 +60,8 @@ export default class Util { let nSearch = search.split(' '); while (!member && nSearch.length > 0) { nSearch = nSearch.slice(0, nSearch.length - 1); - member = guild.members.find((mem) => `${mem.user.username}#${mem.user.discriminator}` === search || mem.user.id === search || mem.user.username === search || mem.user.username.startsWith(search) || mem.user.username.toLowerCase() === search.toLowerCase() || mem.user.username.toLowerCase().startsWith(search.toLowerCase())); + // Name, Mention, or ID + member = guild.members.find((mem) => mem.user.id === message.mentions[0].id || `${mem.user.username}#${mem.user.discriminator}` === search || mem.user.id === search || mem.user.username === search || mem.user.username.startsWith(search) || mem.user.username.toLowerCase() === search.toLowerCase() || mem.user.username.toLowerCase().startsWith(search.toLowerCase())); // Nickname // eslint-disable-next-line no-mixed-operators if (!member) {