Merge branch 'dev'
commit
aeb6e102f6
|
@ -2,6 +2,7 @@ import { Message } from 'eris';
|
|||
import { totalmem } from 'os';
|
||||
import { Client, Command, RichEmbed } from '../class';
|
||||
import { version as erisVersion } from '../../node_modules/eris/package.json';
|
||||
import { version as expressVersion } from '../../node_modules/express/package.json';
|
||||
import { version as mongooseVersion } from '../../node_modules/mongoose/package.json';
|
||||
|
||||
export default class Info extends Command {
|
||||
|
@ -21,9 +22,10 @@ export default class Info extends Command {
|
|||
embed.setThumbnail(this.client.user.avatarURL);
|
||||
embed.addField('Language(s)', '<:TypeScript:703451285789343774> TypeScript', true);
|
||||
embed.addField('Discord Library', `Eris (${erisVersion})`, true);
|
||||
embed.addField('HTTP Server Library', `Express (${expressVersion})`, true);
|
||||
embed.addField('Database Library', `MongoDB w/ Mongoose ODM (${mongooseVersion})`, true);
|
||||
embed.addField('Repository', 'https://gitlab.libraryofcode.org/engineering/communityrelations | Licensed under GNU Affero General Public License V3', true);
|
||||
embed.addField('Memory Usage', `${Math.round(process.memoryUsage().rss / 1024 / 1024)} MB / ${Math.round(totalmem() / 1024 / 1024 / 1024)} GB`, true);
|
||||
embed.addField('Repository', 'https://loc.sh/crgit | Licensed under GNU Affero General Public License V3', true);
|
||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||
embed.setTimestamp();
|
||||
message.channel.createMessage({ embed });
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable no-case-declarations */
|
||||
/* eslint-disable no-continue */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { Message, TextableChannel, Textable } from 'eris';
|
||||
import { Message, TextableChannel } from 'eris';
|
||||
import { Client, Command, RichEmbed } from '../class';
|
||||
|
||||
export default class Page extends Command {
|
||||
|
@ -11,7 +11,7 @@ export default class Page extends Command {
|
|||
super(client);
|
||||
this.name = 'page';
|
||||
this.description = 'Pages the specified emergency number, department number, or individual number with the specified pager code.';
|
||||
this.usage = 'page <pager number> <pager code>';
|
||||
this.usage = 'page <pager number> <pager code> [optional message]';
|
||||
this.aliases = ['p'];
|
||||
this.permissions = 1;
|
||||
this.enabled = true;
|
||||
|
@ -52,7 +52,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], message);
|
||||
const page = await this.page(args[0], sender.num, args[1], message, args[2] ? args.slice(2).join(' ') : undefined);
|
||||
if (page.status === true) {
|
||||
loading.delete();
|
||||
return this.success(message.channel, page.message);
|
||||
|
@ -64,14 +64,15 @@ export default class Page extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
public logPage(sender: { number: string, user?: string }, recipient: { number: string, user?:string }, type: 'discord' | 'email', 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');
|
||||
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 (${type.toUpperCase()})| TO: ${recipient.number}, FROM: ${sender.number}, CODE: ${code}`);
|
||||
}
|
||||
|
||||
public async page(recipientNumber: string, senderNumber: string, code: string, message: Message, options?: { emergencyNumber: string }): Promise<{status: boolean, message: string}> {
|
||||
public async page(recipientNumber: string, senderNumber: string, code: string, message: Message, txt?: string, options?: { emergencyNumber: string }): Promise<{status: boolean, message: string}> {
|
||||
try {
|
||||
if (txt?.length >= 140) return { status: false, message: 'Your message must be less than 141 characters.' };
|
||||
const senderEntry = await this.client.db.PagerNumber.findOne({ num: senderNumber });
|
||||
if (!senderEntry) {
|
||||
return { status: false, message: 'You do not have a Pager Number.' };
|
||||
|
@ -80,29 +81,29 @@ export default class Page extends Command {
|
|||
switch (recipientNumber) {
|
||||
case '#0':
|
||||
this.local.departmentNumbers.forEach(async (num) => {
|
||||
await this.page(num, senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page(num, senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
});
|
||||
break;
|
||||
case '#1':
|
||||
await this.page('00', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('01', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('10', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('20', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('00', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('01', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('10', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('20', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
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, senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page(bsian?.num, senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page(nightraven?.num, senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('10', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page(matthew?.num, senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page(bsian?.num, senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page(nightraven?.num, senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('10', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
break;
|
||||
case '#3':
|
||||
await this.page('00', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('01', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('20', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('21', senderNumber, code, message, { emergencyNumber: '0' });
|
||||
await this.page('00', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('01', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('20', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
await this.page('21', senderNumber, code, message, txt, { emergencyNumber: '0' });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -127,13 +128,13 @@ export default class Page extends Command {
|
|||
} else {
|
||||
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, 'discord', code);
|
||||
}
|
||||
chan.createMessage(`${options?.emergencyNumber ? `[SEN#${options.emergencyNumber}] ` : ''}__**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(`${options?.emergencyNumber ? `[SEN#${options.emergencyNumber}] ` : ''}__**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)})${txt ? `\n**Message:** ${txt}` : ''}`);
|
||||
}
|
||||
for (const email of recipientEntry.emailAddresses) {
|
||||
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);
|
||||
if (!recipient || !sender) {
|
||||
this.logPage({ number: senderNumber, user: 'N/A' }, { number: recipientNumber, user: 'N/A' }, 'discord', code);
|
||||
this.logPage({ number: senderNumber, user: 'N/A' }, { number: recipientNumber, user: 'N/A' }, 'email', code);
|
||||
} else {
|
||||
this.logPage({ number: senderNumber, user: `${sender.username}#${sender.discriminator}` }, { number: recipientNumber, user: `${recipient.username}#${recipient.discriminator}` }, 'email', code);
|
||||
}
|
||||
|
@ -141,7 +142,7 @@ export default class Page extends Command {
|
|||
from: '"LOC Paging System" <internal@libraryofcode.org>',
|
||||
to: email,
|
||||
subject: `PAGE FROM ${recipientNumber}`,
|
||||
html: `<h1>Page</h1>${options?.emergencyNumber ? `<h2>[SEN#${options.emergencyNumber}]` : ''}<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)})`,
|
||||
html: `<h1>Page</h1>${options?.emergencyNumber ? `<h2>[SEN#${options.emergencyNumber}]` : ''}<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)})${txt ? `<br><strong>Message:</strong> ${txt}` : ''}`,
|
||||
});
|
||||
}
|
||||
return { status: true, message: `Page to \`${recipientNumber}\` sent.` };
|
||||
|
|
|
@ -29,15 +29,6 @@ export default class Whois extends Command {
|
|||
}
|
||||
const embed = new RichEmbed();
|
||||
embed.setAuthor(`${member.user.username}#${member.user.discriminator}`, member.user.avatarURL);
|
||||
/* if (member.roles.includes('453689940140883988')) {
|
||||
embed.setThumbnail('https://static.libraryofcode.org/library_of_code_associate-badge.png');
|
||||
} else if (member.roles.includes('455972169449734144')) {
|
||||
embed.setThumbnail('https://static.libraryofcode.org/library_of_code_sheriff-badge.png');
|
||||
} else if (member.roles.includes('662163685439045632')) {
|
||||
embed.setThumbnail('https://static.libraryofcode.org/library_of_code_marshal-badge.png');
|
||||
} else {
|
||||
embed.setThumbnail(member.avatarURL);
|
||||
} */
|
||||
embed.setThumbnail(member.avatarURL);
|
||||
const ackResolve = this.resolveStaffInformation(member.id);
|
||||
let description = '';
|
||||
|
|
Loading…
Reference in New Issue