diff --git a/src/commands/whois.ts b/src/commands/whois.ts index 15facef..24661cb 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -1,7 +1,7 @@ /* eslint-disable no-bitwise */ import moment from 'moment'; -import { Message, Member } from 'eris'; -import { Client, Command, RichEmbed } from '../class'; +import { Member } from 'eris'; +import { Client, CmdContext, Command, RichEmbed } from '../class'; import { whois as emotes } from '../configs/emotes.json'; export default class Whois extends Command { @@ -24,20 +24,20 @@ export default class Whois extends Command { return arr; } - public async run(message: Message, args: string[]) { + public async run(ctx: CmdContext) { let member: Member; - if (!args[0]) member = message.member; + if (!ctx.args[0]) member = ctx.message.member; else { - member = this.client.util.resolveMember(args.join(' '), this.mainGuild); + member = this.client.util.resolveMember(ctx.args.join(' '), this.mainGuild); try { - if (!member) member = await this.mainGuild.getRESTMember(args[0]); + if (!member) member = await this.mainGuild.getRESTMember(ctx.args[0]); } catch { - return this.error(message.channel, 'Member not found.'); + return this.error(ctx.message.channel, 'Member not found.'); } } if (!member) { - return this.error(message.channel, 'Member not found.'); + return this.error(ctx.message.channel, 'Member not found.'); } const embed = new RichEmbed(); embed.setThumbnail(member.avatarURL); @@ -47,7 +47,7 @@ export default class Whois extends Command { if (!ackResolve && mpn) { title += `, ${mpn.join(', ')}`; } - if (ackResolve?.pn?.length > 0) title += `, ${ackResolve.pn.join(', ')}`; + if (ackResolve?.isManager) title += ' [k]'; embed.setAuthor(title, member.user.avatarURL); let description = ''; @@ -61,13 +61,6 @@ export default class Whois extends Command { if (ackResolve?.emailAddress) { 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(); if (memberProfile?.additional?.gitlab) { 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.setTimestamp(); - return message.channel.createMessage({ embed }); + return ctx.uniCreateMessage({ embed }); } }