Merge remote-tracking branch 'upstream/master'
commit
c6cb9be40a
|
@ -62,6 +62,27 @@ export default class Root extends Route {
|
|||
case 'eo':
|
||||
title = 'Executive Order';
|
||||
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;
|
||||
|
||||
case 'motion':
|
||||
|
@ -77,6 +98,27 @@ export default class Root extends Route {
|
|||
case 'res':
|
||||
title = 'Resolution';
|
||||
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;
|
||||
|
||||
case 'confirmMotion':
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* eslint-disable no-bitwise */
|
||||
import axios from 'axios';
|
||||
import nodemailer from 'nodemailer';
|
||||
import childProcess from 'child_process';
|
||||
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[]) {
|
||||
const builtInFormatters = {
|
||||
en: ['KMGTPEZY'.split(''), 1e3],
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable newline-per-chained-call */
|
||||
import { Emoji, GuildTextableChannel, Member, Message } from 'eris';
|
||||
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.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 });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,31 +91,43 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
if (pager.num.startsWith('00') && !member.roles.includes('662163685439045632')) {
|
||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||
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')) {
|
||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||
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')) {
|
||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||
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')) {
|
||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||
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')) {
|
||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||
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')) {
|
||||
await client.db.PagerNumber.deleteOne({ num: pager.num });
|
||||
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) {
|
||||
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
|
||||
if (!pager && member.roles.includes('662163685439045632')) {
|
||||
let randomPagerNumber: string;
|
||||
|
|
|
@ -63,14 +63,8 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
|||
staff: boolean,
|
||||
locked: boolean,
|
||||
notify: boolean,
|
||||
// inquiries: [{ name: string, reason: string, date: Date }?],
|
||||
// softInquiries: [{name: string, date: Date }?]
|
||||
lastUpdated: Date,
|
||||
pin: number[],
|
||||
/* generalMessagesRatio: number,
|
||||
supportMessagesRatio: number,
|
||||
totalModerations: number,
|
||||
notes: number, */
|
||||
} = {
|
||||
userID: member.user.id,
|
||||
total: 0,
|
||||
|
@ -82,8 +76,6 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
|||
staff: false,
|
||||
locked: false,
|
||||
notify: false,
|
||||
// inquiries: [],
|
||||
// softInquiries: [],
|
||||
lastUpdated: new Date(),
|
||||
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);
|
||||
|
||||
/* 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.util.signale.debug(`SCORE SET - ${member.username}\nTotal: ${total}\nActivity: ${activity}\nRoles: ${roles}\nModeration: ${moderation}\nCloud Services: ${cloudServices}\nStaff: ${staff}`);
|
||||
}
|
||||
};
|
||||
await start();
|
||||
|
|
Loading…
Reference in New Issue