Include partial resolver

merge-requests/4/merge
Bsian 2020-04-15 11:26:03 -04:00
parent 7b9d71790d
commit d548b027e1
1 changed files with 2 additions and 1 deletions

View File

@ -50,6 +50,7 @@ export default class Util {
public resolveMember(query: string, { members }: Guild): Member | undefined { public resolveMember(query: string, { members }: Guild): Member | undefined {
return members.find((m) => m.mention.replace('!', '') === query.replace('!', '') || `${m.username}#${m.discriminator}` === query || m.username === query || m.id === query || m.nick === query) // Exact match for mention, username+discrim, username and user ID return members.find((m) => m.mention.replace('!', '') === query.replace('!', '') || `${m.username}#${m.discriminator}` === query || m.username === query || m.id === query || m.nick === query) // Exact match for mention, username+discrim, username and user ID
|| members.find((m) => `${m.username.toLowerCase()}#${m.discriminator}` === query.toLowerCase() || m.username.toLowerCase() === query.toLowerCase() || (m.nick && m.nick.toLowerCase() === query.toLowerCase())) // Case insensitive match for username+discrim, username || members.find((m) => `${m.username.toLowerCase()}#${m.discriminator}` === query.toLowerCase() || m.username.toLowerCase() === query.toLowerCase() || (m.nick && m.nick.toLowerCase() === query.toLowerCase())) // Case insensitive match for username+discrim, username
|| members.find((m) => m.username.toLowerCase().includes(query.toLowerCase()) || (m.nick && m.nick.toLowerCase().includes(query.toLowerCase())))
} }
public async handleError(error: Error, message?: Message, command?: Command): Promise<void> { public async handleError(error: Error, message?: Message, command?: Command): Promise<void> {