Finishing applications

This commit is contained in:
2023-03-12 23:45:13 +01:00
parent 6dbea712d9
commit ad37b8f960
6 changed files with 360 additions and 178 deletions

View File

@@ -0,0 +1,51 @@
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require('discord.js');
const { color } = require('../../options.json');
module.exports = {
name: 'guildapplicationaccept',
description: 'Accept a guild application.',
type: 'button',
async execute(interaction) {
const user = interaction.user;
const channel = interaction.channel;
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
const applicantId = await channel.topic
const applicant = await guild.members.fetch(applicantId)
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
await applicant.send({
embeds: [{
description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor
}]
});
await interaction.reply({
embeds: [{
title: applicantUsername + " - Application",
description: "Application accepted by <@" + user.id + ">.\n\nPress the button below to delete this channel.\n**When the user is added to the guild.**",
color: embedColor,
thumbnail: {
url: applicant.avatarURL()
},
footer: {
iconURL: guild.iconURL(),
text: "ID: " + applicant.id
}
}],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("applicationdelete")
.setLabel("Delete Channel")
.setStyle(ButtonStyle.Danger)
)
]
});
}
};