From 2ca568f245380b0bf44a76390371f1a21479f6e4 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sun, 8 Nov 2020 22:24:49 -0500 Subject: [PATCH] fixes --- src/class/Queue.ts | 15 ++++++++++++++- src/commands/apply.ts | 16 +++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/class/Queue.ts b/src/class/Queue.ts index 5cb9c17..65f5623 100644 --- a/src/class/Queue.ts +++ b/src/class/Queue.ts @@ -88,15 +88,28 @@ export default class Queue { const guild = this.client.guilds.get(job.data.channelInformation.guildID); const channel = guild.channels.get(job.data.channelInformation.channelID); const message = await channel.getMessage(job.data.channelInformation.messageID); + const member = guild.members.get(job.data.userID); await message.delete(); const embed = new RichEmbed(); embed.setTitle('Application Decision'); + if (member) { + embed.setAuthor(member.username, member.avatarURL); + } + if (application.decision === 'APPROVED') { + embed.setColor('#50c878'); + } else if (application.decision === 'DECLINED') { + embed.setColor('#fe0000'); + } else if (application.decision === 'PRE-DECLINE') { + embed.setColor('#ffa500'); + } else { + embed.setColor('#eeeeee'); + } embed.setDescription(`This application was processed by __${application.processedBy}__ on behalf of the vendor, department, or service who operates this application. Please contact the vendor for further information about your application if needed.`); embed.addField('Status', application.decision, true); embed.addField('User ID', job.data.userID, true); embed.addField('Application ID', application.id, true); embed.addField('Job ID', job.id.toString(), true); - embed.setFooter(this.client.user.username, this.client.user.avatarURL); + embed.setFooter(`${this.client.user.username} via Electronic Decision Service [EDS]`, this.client.user.avatarURL); embed.setTimestamp(); await channel.createMessage({ content: `<@${job.data.userID}>`, embed }); if (job.data.func) { diff --git a/src/commands/apply.ts b/src/commands/apply.ts index 9ecf2ae..9def6ae 100644 --- a/src/commands/apply.ts +++ b/src/commands/apply.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-continue */ import type { AxiosError, AxiosStatic } from 'axios'; import axios from 'axios'; import { Member, Message } from 'eris'; @@ -10,7 +11,7 @@ export default class Apply extends Command { super(client); this.name = 'apply'; this.description = 'apply'; - this.usage = `${this.client.config.prefix}apply [serviceName]`; + this.usage = `${this.client.config.prefix}apply [serviceName]\n${this.client.config.prefix}apply full`; this.permissions = 0; this.guildOnly = true; this.enabled = true; @@ -97,10 +98,19 @@ export default class Apply extends Command { public async run(message: Message, args: string[]) { try { - if (!args[0]) { + if (!args[0] || args[0] === 'full') { const embed = new RichEmbed(); - embed.setTitle('Available Instant Applications'); + embed.setTitle('Instant Application Service [IAS]'); + embed.setColor('#556cd6'); + if (args[0] !== 'full') { + embed.setDescription(`*These applications are specified targeted to you based on validation conditions. Run \`${this.client.config.prefix}apply full\` for a full list of all applications.*`); + embed.setThumbnail(message.member.avatarURL); + embed.setAuthor(message.member.username, message.member.avatarURL); + } for (const service of this.services) { + // eslint-disable-next-line no-await-in-loop + const test = await service[1].validation(message.member); + if (!test && args[0] !== 'full') continue; embed.addField(service[0], `**Description**: ${service[1].description}\n**Inquiry Type:** ${service[1].type}\n\n*Run \`${this.client.config.prefix}apply ${service[0]}\` to apply.*`); } embed.setFooter(this.client.user.username, this.client.user.avatarURL);