Updated the apllications to check for left users

Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
2023-10-01 16:57:26 +02:00
parent bb991e2181
commit 410ad5fba2
2 changed files with 27 additions and 21 deletions

View File

@@ -8,12 +8,6 @@ module.exports = {
async execute(interaction) {
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const message = interaction.message;
const modal = new ModalBuilder()
.setTitle('Deny Reason')
.setCustomId('denyreasonbox')

View File

@@ -26,7 +26,6 @@ module.exports = {
const applicant = await guild.members.fetch(applicantId);
const reason = interaction.fields.fields.get('denyreason').value || "No reason provided";
const embedColor = Number(color.replace("#", "0x"));
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
await message.edit({
components: [
@@ -55,24 +54,37 @@ module.exports = {
"**Reason:** `" + reason + "`")
.setColor(embedColor);
const missingUser = new EmbedBuilder()
.setDescription("[WARN] User has left the server and cannot be notified.")
.setColor(embedColor)
const responseEmbed = new EmbedBuilder()
.setTitle("Application Denied")
.setDescription("The application has been denied by <@" + interaction.user.id + ">.\n" +
"**Reason:** `" + reason + "`")
.setColor(embedColor)
.setThumbnail({
url: applicant.avatarURL()
})
.setFooter({
iconURL: guild.iconURL(),
text: "ID: " + applicant.id
})
if (applicant) {
await applicant.send({ embeds: [dmMessage] });
}
if (!applicant) {
var responseEmbeds = [responseEmbed, missingUser];
} else {
var responseEmbeds = [responseEmbed];
}
await guildapp.findOneAndDelete({ userID: applicantId });
await interaction.editReply({
embeds: [{
title: "Application Denied",
description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
"**Reason:** `" + reason + "`",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
},
footer: {
iconURL: guild.iconURL(),
text: "ID: " + applicant.id
}
}],
embeds: responseEmbeds
});
}
}