From abdad4ec7832bf6df0a6314e216e6b79b9df4dd8 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 3 Oct 2020 03:08:13 -0400 Subject: [PATCH] changes to api config --- src/api/loc.sh/routes/internal.ts | 36 +++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/api/loc.sh/routes/internal.ts b/src/api/loc.sh/routes/internal.ts index c3eacd8..d43847a 100644 --- a/src/api/loc.sh/routes/internal.ts +++ b/src/api/loc.sh/routes/internal.ts @@ -1,7 +1,7 @@ import { TextChannel } from 'eris'; /* eslint-disable no-shadow */ import jwt from 'jsonwebtoken'; -import { Route, Server, LocalStorage } from '../../../class'; +import { RichEmbed, Route, Server, LocalStorage } from '../../../class'; // import acknowledgements from '../../../configs/acknowledgements.json'; export default class Internal extends Route { @@ -104,10 +104,42 @@ export default class Internal extends Route { if (staffScore.userID === score.userID) { updated = true; await this.server.client.db.Score.updateOne({ userID: score.userID }, { $addToSet: { softInquiries: { name: `${member.username} via report.libraryofcode.org @ IP ${req.ip}`, date: new Date() } } }); + const embed = new RichEmbed(); + embed.setTitle('Inquiry Notification'); + embed.setColor('#00FFFF'); + embed.addField('Member', `${member.user.username}#${member.user.discriminator} | <@${member.user.id}>`, true); + embed.addField('Type', 'SOFT', true); + embed.addField('Department/Service', `${member.username} via report.libraryofcode.org @ IP ${req.ip}`.toUpperCase(), true); + embed.setTimestamp(); + embed.setFooter(this.server.client.user.username, this.server.client.user.avatarURL); + const chan = this.server.client.guilds.get(this.server.client.config.guildID).channels.get('611584771356622849'); + chan.createMessage({ embed }).catch(() => {}); } else { await this.server.client.db.Score.updateOne({ userID: score.userID }, { $addToSet: { softInquiries: { name: 'Library of Code sp-us | Staff Team via report.libraryofcode.org', date: new Date() } } }); + const embed = new RichEmbed(); + embed.setTitle('Inquiry Notification'); + embed.setColor('#00FFFF'); + embed.addField('Member', `${member.user.username}#${member.user.discriminator} | <@${member.user.id}>`, true); + embed.addField('Type', 'SOFT', true); + embed.addField('Department/Service', 'Library of Code sp-us | Staff Team via report.libraryofcode.org'.toUpperCase(), true); + embed.setTimestamp(); + embed.setFooter(this.server.client.user.username, this.server.client.user.avatarURL); + const chan = this.server.client.guilds.get(this.server.client.config.guildID).channels.get('611584771356622849'); + chan.createMessage({ embed }).catch(() => {}); } - } else if (!updated) await this.server.client.db.Score.updateOne({ userID: score.userID }, { $addToSet: { softInquiries: { name: `${member.username} via report.libraryofcode.org @ IP ${req.ip}`, date: new Date() } } }); + } else if (!updated) { + await this.server.client.db.Score.updateOne({ userID: score.userID }, { $addToSet: { softInquiries: { name: `${member.username} via report.libraryofcode.org @ IP ${req.ip}`, date: new Date() } } }); + const embed = new RichEmbed(); + embed.setTitle('Inquiry Notification'); + embed.setColor('#00FFFF'); + embed.addField('Member', `${member.user.username}#${member.user.discriminator} | <@${member.user.id}>`, true); + embed.addField('Type', 'SOFT', true); + embed.addField('Department/Service', `${member.username} via report.libraryofcode.org @ IP ${req.ip}`.toUpperCase(), true); + embed.setTimestamp(); + embed.setFooter(this.server.client.user.username, this.server.client.user.avatarURL); + const chan = this.server.client.guilds.get(this.server.client.config.guildID).channels.get('611584771356622849'); + chan.createMessage({ embed }).catch(() => {}); + } score = await this.server.client.db.Score.findOne({ pin: [Number(args.split('-')[0]), Number(args.split('-')[1]), Number(args.split('-')[2])] }).lean().exec(); let totalScore = '0';