Finalizing applications
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
node_modules/*
|
||||
applications/*
|
||||
config.json
|
||||
@@ -1,3 +1,6 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
name: 'applicationdelete',
|
||||
description: 'Delete an application channel.',
|
||||
@@ -6,11 +9,17 @@ module.exports = {
|
||||
async execute(interaction) {
|
||||
|
||||
const channel = interaction.channel;
|
||||
const applicantId = await channel.topic;
|
||||
|
||||
await interaction.reply('Application channel will be deleted in 5 seconds');
|
||||
|
||||
setTimeout(async () => {
|
||||
|
||||
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
|
||||
fs.rmSync(filePath, { force: true });
|
||||
|
||||
await channel.delete();
|
||||
|
||||
}, 5000);
|
||||
|
||||
}
|
||||
|
||||
0
events/buttons/checkstats.js
Normal file
0
events/buttons/checkstats.js
Normal file
@@ -1,5 +1,7 @@
|
||||
const { ChannelType, PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js');
|
||||
const { color } = require('../../options.json');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
name: 'guildapply',
|
||||
@@ -14,6 +16,14 @@ module.exports = {
|
||||
|
||||
if (interaction.customId === 'guildapply') {
|
||||
|
||||
// check if there is a file in the applications folder with the user's id as the name
|
||||
const applicationFile = path.join(__dirname, '../../applications/' + user.id);
|
||||
|
||||
if (fs.existsSync(applicationFile)) {
|
||||
await interaction.reply({ content: "You already have an application in progress.", ephemeral: true });
|
||||
return
|
||||
}
|
||||
|
||||
const tooLong = new EmbedBuilder()
|
||||
.setDescription("You took too long to respond.")
|
||||
.setColor(embedColor)
|
||||
@@ -215,6 +225,10 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
|
||||
fs.writeFile(`./applications/${user.id}`, answer1_1, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
await guild.channels.create({
|
||||
name: `Application-${user.username}`,
|
||||
type: ChannelType.GuildText,
|
||||
@@ -286,6 +300,12 @@ module.exports = {
|
||||
.setCustomId("guildapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
),
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("checkstats")
|
||||
.setLabel("Check Stats")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
)
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { color } = require('../../options.json');
|
||||
|
||||
module.exports = {
|
||||
@@ -21,7 +23,9 @@ module.exports = {
|
||||
}]
|
||||
});
|
||||
|
||||
await channel.delete();
|
||||
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
|
||||
fs.rmSync(filePath, { force: true });
|
||||
|
||||
await channel.delete();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user