add t2 pre-approval

pull/29/head
Matthew 2020-10-31 23:46:49 -04:00
parent ad089f28ba
commit 6f72ef9668
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 11 additions and 8 deletions

View File

@ -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();

View File

@ -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 = <AxiosError>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' };
}
}
}