add message reference link to page
parent
560ec693fa
commit
8ad1fdc0cc
|
@ -39,7 +39,7 @@ export default class Page extends Command {
|
|||
message.delete();
|
||||
const loading = await this.loading(message.channel, 'Paging...');
|
||||
const sender = await this.client.db.PagerNumber.findOne({ individualAssignID: message.author.id });
|
||||
const page = await this.page(args[0], sender.num, args[1]);
|
||||
const page = await this.page(args[0], sender.num, args[1], message);
|
||||
if (page.status === true) {
|
||||
loading.delete();
|
||||
return this.success(message.channel, page.message);
|
||||
|
@ -51,7 +51,7 @@ export default class Page extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
public async page(recipientNumber: string, senderNumber: string, code: string): Promise<{status: boolean, message: string}> {
|
||||
public async page(recipientNumber: string, senderNumber: string, code: string, message: Message): Promise<{status: boolean, message: string}> {
|
||||
try {
|
||||
const senderEntry = await this.client.db.PagerNumber.findOne({ num: senderNumber });
|
||||
if (!senderEntry) {
|
||||
|
@ -61,29 +61,29 @@ export default class Page extends Command {
|
|||
switch (recipientNumber) {
|
||||
case '#0':
|
||||
this.local.departmentNumbers.forEach(async (num) => {
|
||||
await this.page(num, '#0', code);
|
||||
await this.page(num, '#0', code, message);
|
||||
});
|
||||
break;
|
||||
case '#1':
|
||||
await this.page('00', '#1', code);
|
||||
await this.page('01', '#1', code);
|
||||
await this.page('10', '#1', code);
|
||||
await this.page('20', '#1', code);
|
||||
await this.page('00', '#1', code, message);
|
||||
await this.page('01', '#1', code, message);
|
||||
await this.page('10', '#1', code, message);
|
||||
await this.page('20', '#1', code, message);
|
||||
break;
|
||||
case '#2':
|
||||
const matthew = await this.client.db.PagerNumber.findOne({ individualAssignID: '278620217221971968' });
|
||||
const bsian = await this.client.db.PagerNumber.findOne({ individualAssignID: '253600545972027394' });
|
||||
const nightraven = await this.client.db.PagerNumber.findOne({ individualAssignID: '239261547959025665' });
|
||||
await this.page(matthew?.num, '#2', code);
|
||||
await this.page(bsian?.num, '#2', code);
|
||||
await this.page(nightraven?.num, '#2', code);
|
||||
await this.page('10', '#2', code);
|
||||
await this.page(matthew?.num, '#2', code, message);
|
||||
await this.page(bsian?.num, '#2', code, message);
|
||||
await this.page(nightraven?.num, '#2', code, message);
|
||||
await this.page('10', '#2', code, message);
|
||||
break;
|
||||
case '#3':
|
||||
await this.page('00', '#3', code);
|
||||
await this.page('01', '#3', code);
|
||||
await this.page('20', '#3', code);
|
||||
await this.page('21', '#3', code);
|
||||
await this.page('00', '#3', code, message);
|
||||
await this.page('01', '#3', code, message);
|
||||
await this.page('20', '#3', code, message);
|
||||
await this.page('21', '#3', code, message);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -102,7 +102,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\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}`);
|
||||
}
|
||||
for (const email of recipientEntry.emailAddresses) {
|
||||
const sender = this.client.guilds.get(this.client.config.guildID).members.get(senderEntry.individualAssignID);
|
||||
|
@ -110,7 +110,7 @@ export default class Page extends Command {
|
|||
from: '"LOC Paging System" <internal@libraryofcode.org>',
|
||||
to: email,
|
||||
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><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}`,
|
||||
});
|
||||
}
|
||||
return { status: true, message: `Page to \`${recipientNumber}\` sent.` };
|
||||
|
|
Loading…
Reference in New Issue