remove post nominals from whois command, add [k] designator for manager staff

ctx
Matthew 2023-02-11 23:48:22 -05:00
parent 7ae2e3a41c
commit f64a13b06e
1 changed files with 10 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/* eslint-disable no-bitwise */ /* eslint-disable no-bitwise */
import moment from 'moment'; import moment from 'moment';
import { Message, Member } from 'eris'; import { Member } from 'eris';
import { Client, Command, RichEmbed } from '../class'; import { Client, CmdContext, Command, RichEmbed } from '../class';
import { whois as emotes } from '../configs/emotes.json'; import { whois as emotes } from '../configs/emotes.json';
export default class Whois extends Command { export default class Whois extends Command {
@ -24,20 +24,20 @@ export default class Whois extends Command {
return arr; return arr;
} }
public async run(message: Message, args: string[]) { public async run(ctx: CmdContext) {
let member: Member; let member: Member;
if (!args[0]) member = message.member; if (!ctx.args[0]) member = ctx.message.member;
else { else {
member = this.client.util.resolveMember(args.join(' '), this.mainGuild); member = this.client.util.resolveMember(ctx.args.join(' '), this.mainGuild);
try { try {
if (!member) member = await this.mainGuild.getRESTMember(args[0]); if (!member) member = await this.mainGuild.getRESTMember(ctx.args[0]);
} catch { } catch {
return this.error(message.channel, 'Member not found.'); return this.error(ctx.message.channel, 'Member not found.');
} }
} }
if (!member) { if (!member) {
return this.error(message.channel, 'Member not found.'); return this.error(ctx.message.channel, 'Member not found.');
} }
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setThumbnail(member.avatarURL); embed.setThumbnail(member.avatarURL);
@ -47,7 +47,7 @@ export default class Whois extends Command {
if (!ackResolve && mpn) { if (!ackResolve && mpn) {
title += `, ${mpn.join(', ')}`; title += `, ${mpn.join(', ')}`;
} }
if (ackResolve?.pn?.length > 0) title += `, ${ackResolve.pn.join(', ')}`; if (ackResolve?.isManager) title += ' [k]';
embed.setAuthor(title, member.user.avatarURL); embed.setAuthor(title, member.user.avatarURL);
let description = ''; let description = '';
@ -61,13 +61,6 @@ export default class Whois extends Command {
if (ackResolve?.emailAddress) { if (ackResolve?.emailAddress) {
description += `${emotes.email} ${ackResolve.emailAddress}\n`; description += `${emotes.email} ${ackResolve.emailAddress}\n`;
} }
const pager = await this.client.db.mongo.PagerNumber.findOne({ individualAssignID: member.user.id }).lean().exec();
if (pager?.num) {
description += `📟 ${pager.num}\n`;
}
if (ackResolve?.extension) {
description += `☎️ ${ackResolve.extension}\n`;
}
const memberProfile = await this.client.db.mongo.Member.findOne({ userID: member.id }).lean().exec(); const memberProfile = await this.client.db.mongo.Member.findOne({ userID: member.id }).lean().exec();
if (memberProfile?.additional?.gitlab) { if (memberProfile?.additional?.gitlab) {
description += `${emotes.gitlab} ${memberProfile?.additional.gitlab}\n`; description += `${emotes.gitlab} ${memberProfile?.additional.gitlab}\n`;
@ -240,6 +233,6 @@ export default class Whois extends Command {
} }
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);
embed.setTimestamp(); embed.setTimestamp();
return message.channel.createMessage({ embed }); return ctx.uniCreateMessage({ embed });
} }
} }