add reference to page recipient messages
parent
8ad1fdc0cc
commit
cdbd835a76
|
@ -5,7 +5,7 @@ import { Message } from 'eris';
|
||||||
import { Client, Command, RichEmbed } from '../class';
|
import { Client, Command, RichEmbed } from '../class';
|
||||||
|
|
||||||
export default class Page extends Command {
|
export default class Page extends Command {
|
||||||
public local: { emergencyNumbers: string[], departmentNumbers: string[], validPagerCodes: string[] };
|
public local: { emergencyNumbers: string[], departmentNumbers: string[], validPagerCodes: string[], codeDict: Map<string, string>, };
|
||||||
|
|
||||||
constructor(client: Client) {
|
constructor(client: Client) {
|
||||||
super(client);
|
super(client);
|
||||||
|
@ -20,9 +20,20 @@ export default class Page extends Command {
|
||||||
emergencyNumbers: ['#0', '#1', '#2', '#3'],
|
emergencyNumbers: ['#0', '#1', '#2', '#3'],
|
||||||
departmentNumbers: ['00', '01', '10', '20', '21', '22'],
|
departmentNumbers: ['00', '01', '10', '20', '21', '22'],
|
||||||
validPagerCodes: ['911', '811', '210', '265', '411', '419', '555'],
|
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[]) {
|
public async run(message: Message, args: string[]) {
|
||||||
try {
|
try {
|
||||||
if (!args[0]) {
|
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 sender = this.client.guilds.get(this.client.config.guildID).members.get(senderEntry.individualAssignID);
|
||||||
const chan = await this.client.getDMChannel(id);
|
const chan = await this.client.getDMChannel(id);
|
||||||
if (!chan) continue;
|
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) {
|
for (const email of recipientEntry.emailAddresses) {
|
||||||
const sender = this.client.guilds.get(this.client.config.guildID).members.get(senderEntry.individualAssignID);
|
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" <internal@libraryofcode.org>',
|
from: '"LOC Paging System" <internal@libraryofcode.org>',
|
||||||
to: email,
|
to: email,
|
||||||
subject: `PAGE FROM ${recipientNumber}`,
|
subject: `PAGE FROM ${recipientNumber}`,
|
||||||
html: `<h1>Page</h1><strong>Recipient PN:</strong> ${recipientNumber}<br><strong>Sender PN:</strong> ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})<br><strong>Initial Command:</strong> https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)<br><br><strong>Pager Code:</strong> ${code}`,
|
html: `<h1>Page</h1><strong>Recipient PN:</strong> ${recipientNumber}<br><strong>Sender PN:</strong> ${senderNumber} (${sender ? `${sender.username}#${sender.discriminator}` : ''})<br><strong>Initial Command:</strong> https://discordapp.com/channels/${message.guild.id}/${message.channel.id}/${message.id} (<#${message.channel.id}>)<br><br><strong>Pager Code:</strong> ${code} (${this.local.codeDict.get(code)})`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return { status: true, message: `Page to \`${recipientNumber}\` sent.` };
|
return { status: true, message: `Page to \`${recipientNumber}\` sent.` };
|
||||||
|
|
Loading…
Reference in New Issue