From 6f72ef9668481a08414d77355c51a37b8c7db973 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 31 Oct 2020 23:46:49 -0400 Subject: [PATCH] add t2 pre-approval --- src/class/Queue.ts | 2 ++ src/commands/apply.ts | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/class/Queue.ts b/src/class/Queue.ts index 52dfd07..edf0557 100644 --- a/src/class/Queue.ts +++ b/src/class/Queue.ts @@ -66,8 +66,10 @@ export default class Queue { await message.delete(); const embed = new RichEmbed(); embed.setTitle('Application Decision'); + 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.setTimestamp(); diff --git a/src/commands/apply.ts b/src/commands/apply.ts index 0db582c..efbd5a8 100644 --- a/src/commands/apply.ts +++ b/src/commands/apply.ts @@ -45,13 +45,12 @@ export default class Apply extends Command { }, }); - /* this.services.set('cs::t2', { + this.services.set('p::cs::t2', { description: 'Pre-approval for Tier 2.', type: 'SOFT', - url: 'https://eds.libraryofcode.org/cs/t2pre-get', - validation: (member: Member) => !member.roles.includes('546457886440685578'), + url: 'https://eds.libraryofcode.org/cs/t2pre', + validation: (member: Member) => member.roles.includes('546457886440685578'), }); - */ } public async run(message: Message, args: string[]) { @@ -60,7 +59,7 @@ export default class Apply extends Command { const embed = new RichEmbed(); embed.setTitle('Available Instant Applications'); for (const service of this.services) { - embed.addField(service[0], `__**Description**__\n${service[1].description}\n__**Inquiry Type**__\n${service[1].type}\n\n*Run \`${this.client.config.prefix}apply ${service[0]}\` to apply.*`); + 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); embed.setTimestamp(); @@ -72,7 +71,7 @@ export default class Apply extends Command { const test = await this.services.get(args[0]).validation(message.member); if (!test) return this.error(message.channel, 'A condition exists which prevents you from applying, please try again later.'); const msg = await this.loading(message.channel, 'Thank you for submitting an application. We are currently processing it, you will be pinged here shortly with the decision.'); - return await this.client.queue.processApplication({ channelID: message.channel.id, guildID: this.mainGuild.id, messageID: msg.id }, service.url, message.author.id, service.func.toString()); + return await this.client.queue.processApplication({ channelID: message.channel.id, guildID: this.mainGuild.id, messageID: msg.id }, service.url, message.author.id, service.func ? service.func.toString() : undefined); } catch (err) { return this.client.util.handleError(err, message, this); } @@ -88,11 +87,13 @@ export default class Apply extends Command { return { status: 'SUCCESS', decision: data.decision, + id: data.id, + processedBy: data.processedBy, }; } catch (err) { const error = err; - if (error.response?.status === 404 || error.response.status === 400 || error.response.status === 401) return { status: 'CLIENT_ERROR', decision: 'PRE-DECLINED' }; - return { status: 'SERVER_ERROR', decision: 'PRE-DECLINED' }; + if (error.response?.status === 404 || error.response.status === 400 || error.response.status === 401) return { id: 'N/A', processedBy: 'N/A', status: 'CLIENT_ERROR', decision: 'PRE-DECLINED' }; + return { id: 'N/A', processedBy: 'N/A', status: 'SERVER_ERROR', decision: 'PRE-DECLINED' }; } } }