changes to log
parent
abe5af2f91
commit
133ded93c6
|
@ -64,10 +64,10 @@ export default class Page extends Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public logPage(sender: { number: string, user?: string }, recipient: { number: string, user?:string }, code: string): void {
|
public logPage(sender: { number: string, user?: string }, recipient: { number: string, user?:string }, type: 'discord' | 'email', code: string): void {
|
||||||
const chan = <TextableChannel> this.client.guilds.get(this.client.config.guildID).channels.get('722636436716781619');
|
const chan = <TextableChannel> this.client.guilds.get(this.client.config.guildID).channels.get('722636436716781619');
|
||||||
chan.createMessage(`***\`${sender.number} (${sender.user ? sender.user : ''})\` sent a page to \`${recipient.number} (${recipient.user ? recipient.user : ''})\` with code \`${code}\`.***`);
|
chan.createMessage(`***[${type.toUpperCase}] \`${sender.number} (${sender.user ? sender.user : ''})\` sent a page to \`${recipient.number} (${recipient.user ? recipient.user : ''})\` with code \`${code}\`.***`);
|
||||||
this.client.util.signale.log(`PAGE | TO: ${recipient.number}, FROM: ${sender.number}, code: ${code}`);
|
this.client.util.signale.log(`PAGE (${type.toUpperCase()})| TO: ${recipient.number}, FROM: ${sender.number}, CODE: ${code}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async page(recipientNumber: string, senderNumber: string, code: string, message: Message): Promise<{status: boolean, message: string}> {
|
public async page(recipientNumber: string, senderNumber: string, code: string, message: Message): Promise<{status: boolean, message: string}> {
|
||||||
|
@ -122,13 +122,13 @@ 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;
|
||||||
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, code);
|
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, 'discord', 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)})`);
|
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 recipient = this.client.guilds.get(this.client.config.guildID).members.get(recipientEntry.individualAssignID);
|
const recipient = this.client.guilds.get(this.client.config.guildID).members.get(recipientEntry.individualAssignID);
|
||||||
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);
|
||||||
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, code);
|
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, 'email', code);
|
||||||
await this.client.util.transporter.sendMail({
|
await this.client.util.transporter.sendMail({
|
||||||
from: '"LOC Paging System" <internal@libraryofcode.org>',
|
from: '"LOC Paging System" <internal@libraryofcode.org>',
|
||||||
to: email,
|
to: email,
|
||||||
|
|
Loading…
Reference in New Issue