dumb bug fix

This commit is contained in:
Erik 2020-08-10 03:00:49 +03:00
parent 7b23cac660
commit 5e65e219d7

View File

@ -254,13 +254,13 @@ class Resolver {
const m = resolveable.match(/^@?([\S\s]{1,32})#([0-9]{4})/u);
const username = m[1].toLowerCase();
const discrim = m[2].toLowerCase();
const user = users.cache.sort((a, b) => a.name.length - b.name.length).filter((u) => u.username.toLowerCase() === username && u.discriminator === discrim).first();
const user = users.cache.sort((a, b) => a.username.length - b.username.length).filter((u) => u.username.toLowerCase() === username && u.discriminator === discrim).first();
if(user) resolved.push(user);
} else if(!strict) {
const name = resolveable.toLowerCase();
const user = users.cache.sort((a, b) => a.name.length - b.name.length).filter((u) => u.username.toLowerCase().includes(name)).first();
const user = users.cache.sort((a, b) => a.username.length - b.username.length).filter((u) => u.username.toLowerCase().includes(name)).first();
if(user) resolved.push(user);
}
@ -330,7 +330,7 @@ class Resolver {
} else if((/^@?([\S\s]{1,32})/u).test(resolveable) && guild && !strict) {
const nickname = resolveable.match(/^@?([\S\s]{1,32})/u)[0].toLowerCase();
const member = members.cache.sort((a, b) => a.name.length - b.name.length).filter((m) => m && m.user &&
const member = members.cache.sort((a, b) => a.user.username.length - b.user.username.length).filter((m) => m && m.user &&
((!m.nickname ? false : m.nickname.toLowerCase() === nickname) ||
(!m.nickname ? false : m.nickname.toLowerCase().includes(nickname)) ||
m.user.username.toLowerCase().includes(nickname) ||