Merge branch 'master' into 'master'
Resolver & command update See merge request engineering/communityrelations!2merge-requests/4/merge
commit
f16935da6a
|
@ -49,7 +49,8 @@ export default class Util {
|
||||||
|
|
||||||
public resolveMember(message: Message, search: string, guild: Guild): Member | undefined {
|
public resolveMember(message: Message, search: string, guild: Guild): Member | undefined {
|
||||||
try {
|
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
|
// Nickname
|
||||||
// eslint-disable-next-line no-mixed-operators
|
// eslint-disable-next-line no-mixed-operators
|
||||||
if (!member) {
|
if (!member) {
|
||||||
|
@ -59,7 +60,8 @@ export default class Util {
|
||||||
let nSearch = search.split(' ');
|
let nSearch = search.split(' ');
|
||||||
while (!member && nSearch.length > 0) {
|
while (!member && nSearch.length > 0) {
|
||||||
nSearch = nSearch.slice(0, nSearch.length - 1);
|
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
|
// Nickname
|
||||||
// eslint-disable-next-line no-mixed-operators
|
// eslint-disable-next-line no-mixed-operators
|
||||||
if (!member) {
|
if (!member) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default class Whois extends Command {
|
||||||
if (!args[0]) member = message.member;
|
if (!args[0]) member = message.member;
|
||||||
else {
|
else {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
member = this.client.util.resolveMember(message, args[0], message.channel.guild);
|
member = this.client.util.resolveMember(message, args.join(' '), message.channel.guild);
|
||||||
if (!member) {
|
if (!member) {
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Member not found.***`);
|
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Member not found.***`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue