From cdbd835a763b10305801122d079c255f32c19833 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 15 Jun 2020 23:00:49 -0400 Subject: [PATCH] add reference to page recipient messages --- src/commands/page.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/commands/page.ts b/src/commands/page.ts index 82d2303..57a57c1 100644 --- a/src/commands/page.ts +++ b/src/commands/page.ts @@ -5,7 +5,7 @@ import { Message } from 'eris'; import { Client, Command, RichEmbed } from '../class'; export default class Page extends Command { - public local: { emergencyNumbers: string[], departmentNumbers: string[], validPagerCodes: string[] }; + public local: { emergencyNumbers: string[], departmentNumbers: string[], validPagerCodes: string[], codeDict: Map, }; constructor(client: Client) { super(client); @@ -20,9 +20,20 @@ export default class Page extends Command { emergencyNumbers: ['#0', '#1', '#2', '#3'], departmentNumbers: ['00', '01', '10', '20', '21', '22'], validPagerCodes: ['911', '811', '210', '265', '411', '419', '555'], + codeDict: new Map(), }; } + public init() { + this.local.codeDict.set('911', 'Sender is requesting EMERGENCY assistance.'); + this.local.codeDict.set('811', 'Sender is requesting immediate/ASAP assistance.'); + this.local.codeDict.set('210', 'Sender is informing you they acknowledged your request, usually sent in response to OK the initial page. (10-4)'); + this.local.codeDict.set('265', 'Sender is requesting that you check your email.'); + this.local.codeDict.set('411', 'Sender is requesting information/counsel from you.'); + this.local.codeDict.set('419', 'Sender didn\'t recognize your request.'); + this.local.codeDict.set('555', 'Sender is requesting that you contact them.'); + } + public async run(message: Message, args: string[]) { try { if (!args[0]) { @@ -102,7 +113,7 @@ export default class Page extends Command { const sender = this.client.guilds.get(this.client.config.guildID).members.get(senderEntry.individualAssignID); const chan = await this.client.getDMChannel(id); if (!chan) continue; - chan.createMessage(`__**Page**__\n**Recipient PN:** ${recipientNumber}\n**Sender PN:** ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})\n**Initial Command:** https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)\n\n**Pager Code:** ${code}`); + chan.createMessage(`__**Page**__\n**Recipient PN:** ${recipientNumber}\n**Sender PN:** ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})\n**Initial Command:** https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)\n\n**Pager Code:** ${code} (${this.local.codeDict.get(code)})`); } for (const email of recipientEntry.emailAddresses) { const sender = this.client.guilds.get(this.client.config.guildID).members.get(senderEntry.individualAssignID); @@ -110,7 +121,7 @@ export default class Page extends Command { from: '"LOC Paging System" ', to: email, subject: `PAGE FROM ${recipientNumber}`, - html: `

Page

Recipient PN: ${recipientNumber}
Sender PN: ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})
Initial Command: https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)

Pager Code: ${code}`, + html: `

Page

Recipient PN: ${recipientNumber}
Sender PN: ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})
Initial Command: https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)

Pager Code: ${code} (${this.local.codeDict.get(code)})`, }); } return { status: true, message: `Page to \`${recipientNumber}\` sent.` };