Finishing applications
This commit is contained in:
51
events/buttons/guildapplicationaccept.js
Normal file
51
events/buttons/guildapplicationaccept.js
Normal 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)
|
||||
)
|
||||
]
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user