From 104cd698625345dc417c004e1b9e5862829a6564 Mon Sep 17 00:00:00 2001 From: Null Date: Wed, 15 Apr 2020 10:59:22 -0500 Subject: [PATCH] Fix member resolver --- src/class/Util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/class/Util.ts b/src/class/Util.ts index b54062e..674255b 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -64,8 +64,8 @@ export default class Util { let member = members.find((m) => m.mention.replace('!', '') === queries.replace('!', '') || `${m.username}#${m.discriminator}` === query || m.username === queries || m.id === queries || m.nick === queries) // Exact match for mention, username+discrim, username and user ID || members.find((m) => `${m.username.toLowerCase()}#${m.discriminator}` === queries.toLowerCase() || m.username.toLowerCase() === queries.toLowerCase() || (m.nick && m.nick.toLowerCase() === queries.toLowerCase())) // Case insensitive match for username+discrim, username || members.find((m) => m.username.toLowerCase().startsWith(queries.toLowerCase()) || (m.nick && m.nick.toLowerCase().startsWith(queries.toLowerCase()))); - if (queries.length > 1 && !member) { - while (!member && queries.length > 0) { + if (queries.split(' ').length > 1 && !member) { + while (!member && queries.split(' ').length > 0) { queries = queries.split(' ').slice(0, queries.length - 1).join(' '); member = members.find((m) => m.mention.replace('!', '') === queries.replace('!', '') || `${m.username}#${m.discriminator}` === query || m.username === queries || m.id === queries || m.nick === queries) // Exact match for mention, username+discrim, username and user ID || members.find((m) => `${m.username.toLowerCase()}#${m.discriminator}` === queries.toLowerCase() || m.username.toLowerCase() === queries.toLowerCase() || (m.nick && m.nick.toLowerCase() === queries.toLowerCase())) // Case insensitive match for username+discrim, username