pull/29/head
Matthew 2020-11-08 22:24:49 -05:00
parent 70c10a9a4b
commit 2ca568f245
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 27 additions and 4 deletions

View File

@ -88,15 +88,28 @@ export default class Queue {
const guild = this.client.guilds.get(job.data.channelInformation.guildID); const guild = this.client.guilds.get(job.data.channelInformation.guildID);
const channel = <TextableChannel> guild.channels.get(job.data.channelInformation.channelID); const channel = <TextableChannel> guild.channels.get(job.data.channelInformation.channelID);
const message = await channel.getMessage(job.data.channelInformation.messageID); const message = await channel.getMessage(job.data.channelInformation.messageID);
const member = guild.members.get(job.data.userID);
await message.delete(); await message.delete();
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setTitle('Application Decision'); 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.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('Status', application.decision, true);
embed.addField('User ID', job.data.userID, true); embed.addField('User ID', job.data.userID, true);
embed.addField('Application ID', application.id, true); embed.addField('Application ID', application.id, true);
embed.addField('Job ID', job.id.toString(), 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(); embed.setTimestamp();
await channel.createMessage({ content: `<@${job.data.userID}>`, embed }); await channel.createMessage({ content: `<@${job.data.userID}>`, embed });
if (job.data.func) { if (job.data.func) {

View File

@ -1,3 +1,4 @@
/* eslint-disable no-continue */
import type { AxiosError, AxiosStatic } from 'axios'; import type { AxiosError, AxiosStatic } from 'axios';
import axios from 'axios'; import axios from 'axios';
import { Member, Message } from 'eris'; import { Member, Message } from 'eris';
@ -10,7 +11,7 @@ export default class Apply extends Command {
super(client); super(client);
this.name = 'apply'; this.name = 'apply';
this.description = '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.permissions = 0;
this.guildOnly = true; this.guildOnly = true;
this.enabled = true; this.enabled = true;
@ -97,10 +98,19 @@ export default class Apply extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) { if (!args[0] || args[0] === 'full') {
const embed = new RichEmbed(); 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) { 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.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.setFooter(this.client.user.username, this.client.user.avatarURL);