Finalizing applications
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
node_modules/*
|
node_modules/*
|
||||||
|
applications/*
|
||||||
config.json
|
config.json
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'applicationdelete',
|
name: 'applicationdelete',
|
||||||
description: 'Delete an application channel.',
|
description: 'Delete an application channel.',
|
||||||
@@ -6,11 +9,17 @@ module.exports = {
|
|||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
|
|
||||||
const channel = interaction.channel;
|
const channel = interaction.channel;
|
||||||
|
const applicantId = await channel.topic;
|
||||||
|
|
||||||
await interaction.reply('Application channel will be deleted in 5 seconds');
|
await interaction.reply('Application channel will be deleted in 5 seconds');
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
|
||||||
|
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
|
||||||
|
fs.rmSync(filePath, { force: true });
|
||||||
|
|
||||||
await channel.delete();
|
await channel.delete();
|
||||||
|
|
||||||
}, 5000);
|
}, 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 { ChannelType, PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const { color } = require('../../options.json');
|
const { color } = require('../../options.json');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'guildapply',
|
name: 'guildapply',
|
||||||
@@ -14,6 +16,14 @@ module.exports = {
|
|||||||
|
|
||||||
if (interaction.customId === 'guildapply') {
|
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()
|
const tooLong = new EmbedBuilder()
|
||||||
.setDescription("You took too long to respond.")
|
.setDescription("You took too long to respond.")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
@@ -214,6 +224,10 @@ module.exports = {
|
|||||||
color: embedColor
|
color: embedColor
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
fs.writeFile(`./applications/${user.id}`, answer1_1, function (err) {
|
||||||
|
if (err) throw err;
|
||||||
|
});
|
||||||
|
|
||||||
await guild.channels.create({
|
await guild.channels.create({
|
||||||
name: `Application-${user.username}`,
|
name: `Application-${user.username}`,
|
||||||
@@ -286,6 +300,12 @@ module.exports = {
|
|||||||
.setCustomId("guildapplicationdeny")
|
.setCustomId("guildapplicationdeny")
|
||||||
.setLabel("Deny")
|
.setLabel("Deny")
|
||||||
.setStyle(ButtonStyle.Danger)
|
.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');
|
const { color } = require('../../options.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -21,7 +23,9 @@ module.exports = {
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
|
||||||
|
fs.rmSync(filePath, { force: true });
|
||||||
|
|
||||||
await channel.delete();
|
await channel.delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user