Merge branch 'dev' into 'main'

Updated the apllications to check for left users

See merge request illegitimate/illegitimate-bot!29
This commit is contained in:
2023-10-01 15:01:31 +00:00
2 changed files with 27 additions and 21 deletions

View File

@@ -8,12 +8,6 @@ module.exports = {
async execute(interaction) { 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() const modal = new ModalBuilder()
.setTitle('Deny Reason') .setTitle('Deny Reason')
.setCustomId('denyreasonbox') .setCustomId('denyreasonbox')

View File

@@ -26,7 +26,6 @@ module.exports = {
const applicant = await guild.members.fetch(applicantId); const applicant = await guild.members.fetch(applicantId);
const reason = interaction.fields.fields.get('denyreason').value || "No reason provided"; const reason = interaction.fields.fields.get('denyreason').value || "No reason provided";
const embedColor = Number(color.replace("#", "0x")); const embedColor = Number(color.replace("#", "0x"));
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
await message.edit({ await message.edit({
components: [ components: [
@@ -55,24 +54,37 @@ module.exports = {
"**Reason:** `" + reason + "`") "**Reason:** `" + reason + "`")
.setColor(embedColor); .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] }); await applicant.send({ embeds: [dmMessage] });
}
if (!applicant) {
var responseEmbeds = [responseEmbed, missingUser];
} else {
var responseEmbeds = [responseEmbed];
}
await guildapp.findOneAndDelete({ userID: applicantId }); await guildapp.findOneAndDelete({ userID: applicantId });
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: responseEmbeds
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
}
}],
}); });
} }
} }