Adding staff apply
This commit is contained in:
28
events/buttons/staffapplicationdelete.js
Normal file
28
events/buttons/staffapplicationdelete.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
name: 'staffapplicationdelete',
|
||||
description: 'Delete an application channel.',
|
||||
type: 'button',
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
const channel = interaction.channel;
|
||||
const applicantId = await channel.topic;
|
||||
|
||||
await interaction.editReply('Application channel will be deleted in 5 seconds');
|
||||
|
||||
setTimeout(async () => {
|
||||
|
||||
const filePath = path.join(__dirname, `../../apps/staff/${applicantId}`);
|
||||
fs.rmSync(filePath, { force: true });
|
||||
|
||||
await channel.delete();
|
||||
|
||||
}, 5000);
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user