Merge remote-tracking branch 'upstream/master'
commit
c6cb9be40a
|
@ -62,6 +62,27 @@ export default class Root extends Route {
|
||||||
case 'eo':
|
case 'eo':
|
||||||
title = 'Executive Order';
|
title = 'Executive Order';
|
||||||
color = 0xff00a7;
|
color = 0xff00a7;
|
||||||
|
this.server.client.util.transporter.sendMail({
|
||||||
|
to: 'all-staff@lists.libraryofcode.org',
|
||||||
|
from: 'Board Register System <internal@staff.libraryofcode.org>',
|
||||||
|
subject: `EXECUTIVE ORDER ${id}`,
|
||||||
|
text: `
|
||||||
|
EXECUTIVE ORDER ${id}
|
||||||
|
|
||||||
|
ISSUED BY:
|
||||||
|
${director.member.username}, ${director.user.pn.join(', ')}
|
||||||
|
|
||||||
|
SUBJECT:
|
||||||
|
${payload.subject}
|
||||||
|
|
||||||
|
BODY:
|
||||||
|
${payload.body}
|
||||||
|
|
||||||
|
_____________________________________________________________________
|
||||||
|
LIBRARY OF CODE SP-US | BOARD OF DIRECTORS
|
||||||
|
BOARD REGISTER SYSTEM https://board.ins/
|
||||||
|
`,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'motion':
|
case 'motion':
|
||||||
|
@ -77,6 +98,27 @@ export default class Root extends Route {
|
||||||
case 'res':
|
case 'res':
|
||||||
title = 'Resolution';
|
title = 'Resolution';
|
||||||
color = 0x27b17a;
|
color = 0x27b17a;
|
||||||
|
this.server.client.util.transporter.sendMail({
|
||||||
|
to: 'all-staff@lists.libraryofcode.org',
|
||||||
|
from: 'Board Register System <internal@staff.libraryofcode.org>',
|
||||||
|
subject: `RESOLUTION ${id}`,
|
||||||
|
text: `
|
||||||
|
RESOLUTION ${id}
|
||||||
|
|
||||||
|
SPONSOR:
|
||||||
|
${director.member.username}, ${director.user.pn.join(', ')}
|
||||||
|
|
||||||
|
SUBJECT:
|
||||||
|
${payload.subject}
|
||||||
|
|
||||||
|
BODY:
|
||||||
|
${payload.body}
|
||||||
|
|
||||||
|
_____________________________________________________________________
|
||||||
|
LIBRARY OF CODE SP-US | BOARD OF DIRECTORS
|
||||||
|
BOARD REGISTER SYSTEM https://board.ins/
|
||||||
|
`,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'confirmMotion':
|
case 'confirmMotion':
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable no-bitwise */
|
/* eslint-disable no-bitwise */
|
||||||
|
import axios from 'axios';
|
||||||
import nodemailer from 'nodemailer';
|
import nodemailer from 'nodemailer';
|
||||||
import childProcess from 'child_process';
|
import childProcess from 'child_process';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
@ -46,6 +47,32 @@ export default class Util {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async addUserToMailingList(email: string, list: string) {
|
||||||
|
try {
|
||||||
|
const { data } = await axios({
|
||||||
|
method: 'POST',
|
||||||
|
url: `localhost:2161/list/${list}/`,
|
||||||
|
params: { auth: this.client.config.internalKey, email },
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async removeUserFromMailingList(email: string, list: string) {
|
||||||
|
try {
|
||||||
|
const { data } = await axios({
|
||||||
|
method: 'DELETE',
|
||||||
|
url: `localhost:2161/list/${list}/`,
|
||||||
|
params: { auth: this.client.config.internalKey, email },
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public hrn(number: any, fixed: number, formatter: any | any[]) {
|
public hrn(number: any, fixed: number, formatter: any | any[]) {
|
||||||
const builtInFormatters = {
|
const builtInFormatters = {
|
||||||
en: ['KMGTPEZY'.split(''), 1e3],
|
en: ['KMGTPEZY'.split(''), 1e3],
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable newline-per-chained-call */
|
||||||
import { Emoji, GuildTextableChannel, Member, Message } from 'eris';
|
import { Emoji, GuildTextableChannel, Member, Message } from 'eris';
|
||||||
import { Client, Event, RichEmbed } from '../class';
|
import { Client, Event, RichEmbed } from '../class';
|
||||||
|
|
||||||
|
@ -101,6 +102,34 @@ export default class MessageReactionAdd extends Event {
|
||||||
embed.setFooter('Library of Code sp-us | Board Register System', 'https://static.libraryofcode.org/library_of_code.png');
|
embed.setFooter('Library of Code sp-us | Board Register System', 'https://static.libraryofcode.org/library_of_code.png');
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
|
|
||||||
|
this.client.util.transporter.sendMail({
|
||||||
|
to: 'all-staff@lists.libraryofcode.org',
|
||||||
|
from: 'Board Register System <internal@staff.libraryofcode.org>',
|
||||||
|
subject: `PROCLAMATION ${proc.oID}`,
|
||||||
|
text: `
|
||||||
|
PROCLAMATION ${proc.oID}
|
||||||
|
|
||||||
|
SPONSOR:
|
||||||
|
${message.embeds[0].author.name.split('#').slice(0, 1)}, ${message.embeds[0].author.name.split('#').slice(1).join(' ').split(', ').slice(1).join(', ')}
|
||||||
|
|
||||||
|
VOTING RESULTS:
|
||||||
|
YEA: ${proc.results.yea}
|
||||||
|
NAY: ${proc.results.nay}
|
||||||
|
PRESENT ${proc.results.present}
|
||||||
|
|
||||||
|
SUBJECT:
|
||||||
|
${proc.subject}
|
||||||
|
|
||||||
|
BODY:
|
||||||
|
${proc.body}
|
||||||
|
|
||||||
|
|
||||||
|
_____________________________________________________________________
|
||||||
|
LIBRARY OF CODE SP-US | BOARD OF DIRECTORS
|
||||||
|
BOARD REGISTER SYSTEM https://board.ins/
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
await message.channel.createMessage({ embed });
|
await message.channel.createMessage({ embed });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,31 +91,43 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
||||||
if (pager.num.startsWith('00') && !member.roles.includes('662163685439045632')) {
|
if (pager.num.startsWith('00') && !member.roles.includes('662163685439045632')) {
|
||||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||||
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
||||||
|
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
|
||||||
}
|
}
|
||||||
if (pager.num.startsWith('01') && !member.roles.includes('701454855952138300')) {
|
if (pager.num.startsWith('01') && !member.roles.includes('701454855952138300')) {
|
||||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||||
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
||||||
|
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
|
||||||
}
|
}
|
||||||
if (pager.num.startsWith('10') && !member.roles.includes('701454780828221450')) {
|
if (pager.num.startsWith('10') && !member.roles.includes('701454780828221450')) {
|
||||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||||
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
||||||
|
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
|
||||||
}
|
}
|
||||||
if (pager.num.startsWith('20') && !member.roles.includes('455972169449734144')) {
|
if (pager.num.startsWith('20') && !member.roles.includes('455972169449734144')) {
|
||||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||||
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
||||||
|
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
|
||||||
}
|
}
|
||||||
if (pager.num.startsWith('21') && !member.roles.includes('453689940140883988')) {
|
if (pager.num.startsWith('21') && !member.roles.includes('453689940140883988')) {
|
||||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||||
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
||||||
|
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
|
||||||
}
|
}
|
||||||
if (pager.num.startsWith('22') && !member.roles.includes('701481967149121627')) {
|
if (pager.num.startsWith('22') && !member.roles.includes('701481967149121627')) {
|
||||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||||
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
|
||||||
|
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const member of members) {
|
for (const member of members) {
|
||||||
let pager = await client.db.PagerNumber.findOne({ individualAssignID: member.id }).lean().exec();
|
let pager = await client.db.PagerNumber.findOne({ individualAssignID: member.id }).lean().exec();
|
||||||
|
|
||||||
|
// ADD TO ALL STAFF MAILING LIST
|
||||||
|
if ((member.roles.includes('453689940140883988') || member.roles.includes('701481967149121627')) && !pager) {
|
||||||
|
const acknowledgement = await resolveStaffInformation(member.id);
|
||||||
|
await client.util.addUserToMailingList(acknowledgement.emailAddress, 'all-staff');
|
||||||
|
}
|
||||||
// Directors
|
// Directors
|
||||||
if (!pager && member.roles.includes('662163685439045632')) {
|
if (!pager && member.roles.includes('662163685439045632')) {
|
||||||
let randomPagerNumber: string;
|
let randomPagerNumber: string;
|
||||||
|
|
|
@ -63,14 +63,8 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
||||||
staff: boolean,
|
staff: boolean,
|
||||||
locked: boolean,
|
locked: boolean,
|
||||||
notify: boolean,
|
notify: boolean,
|
||||||
// inquiries: [{ name: string, reason: string, date: Date }?],
|
|
||||||
// softInquiries: [{name: string, date: Date }?]
|
|
||||||
lastUpdated: Date,
|
lastUpdated: Date,
|
||||||
pin: number[],
|
pin: number[],
|
||||||
/* generalMessagesRatio: number,
|
|
||||||
supportMessagesRatio: number,
|
|
||||||
totalModerations: number,
|
|
||||||
notes: number, */
|
|
||||||
} = {
|
} = {
|
||||||
userID: member.user.id,
|
userID: member.user.id,
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -82,8 +76,6 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
||||||
staff: false,
|
staff: false,
|
||||||
locked: false,
|
locked: false,
|
||||||
notify: false,
|
notify: false,
|
||||||
// inquiries: [],
|
|
||||||
// softInquiries: [],
|
|
||||||
lastUpdated: new Date(),
|
lastUpdated: new Date(),
|
||||||
pin: [client.util.randomNumber(100, 999), client.util.randomNumber(10, 99), client.util.randomNumber(1000, 9999)],
|
pin: [client.util.randomNumber(100, 999), client.util.randomNumber(10, 99), client.util.randomNumber(1000, 9999)],
|
||||||
};
|
};
|
||||||
|
@ -184,14 +176,7 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
||||||
|
|
||||||
total = Math.floor(((total + activity + roles + moderation + cloudServices + staff + other) * 5.13) * 1.87);
|
total = Math.floor(((total + activity + roles + moderation + cloudServices + staff + other) * 5.13) * 1.87);
|
||||||
|
|
||||||
/* await score.updateOne({ $set: { total, activity, roles, moderation, cloudServices, other, staff, lastUpdate: new Date() } });
|
|
||||||
if (!score.pin || score.pin?.length < 1) {
|
|
||||||
await client.db.Score.updateOne({ userID: member.id }, { $set: { pin: [client.util.randomNumber(100, 999), client.util.randomNumber(10, 99), client.util.randomNumber(1000, 9999)] } });
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
client.queue.updateScore(score, total, activity, roles, moderation, cloudServices, other, staff);
|
client.queue.updateScore(score, total, activity, roles, moderation, cloudServices, other, staff);
|
||||||
// client.util.signale.debug(`SCORE SET - ${member.username}\nTotal: ${total}\nActivity: ${activity}\nRoles: ${roles}\nModeration: ${moderation}\nCloud Services: ${cloudServices}\nStaff: ${staff}`);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await start();
|
await start();
|
||||||
|
|
Loading…
Reference in New Issue