Updating to add defer reply

This commit is contained in:
2023-03-19 13:53:00 +01:00
parent 02ae88ad64
commit c9cc8e4e52
5 changed files with 20 additions and 14 deletions

View File

@@ -8,14 +8,16 @@ module.exports = {
async execute(interaction) {
await interaction.deferReply();
const channel = interaction.channel;
const applicantId = await channel.topic;
await interaction.reply('Application channel will be deleted in 5 seconds');
await interaction.editReply('Application channel will be deleted in 5 seconds');
setTimeout(async () => {
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
fs.rmSync(filePath, { force: true });
await channel.delete();

View File

@@ -16,7 +16,7 @@ module.exports = {
const channel = interaction.channel;
const applicantId = await channel.topic
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
const uuid = fs.readFileSync(filePath, 'utf8');
@@ -42,7 +42,7 @@ module.exports = {
return
}
await interaction.reply({
await interaction.editReply({
embeds: [{
title: stats.data.username,
description: "**Network Level:** `" + stats.data.level.toString() + "`\n" +

View File

@@ -31,9 +31,11 @@ module.exports = {
if (interaction.customId === 'guildapply') {
const applicationFile = path.join(__dirname, '../../applications/' + user.id);
await interaction.deferReply();
const applicationFile = path.join(__dirname, '../../apps/guild/' + user.id);
if (fs.existsSync(applicationFile)) {
await interaction.reply({ content: "You already have an application in progress.", ephemeral: true });
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true });
return
}
@@ -60,11 +62,11 @@ module.exports = {
}]
})
} catch (error) {
await interaction.reply({ content: "Please enable your DMs.", ephemeral: true });
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true });
return
}
await interaction.reply({ content: "Please check your DMs.", ephemeral: true})
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true})
const input = await user.dmChannel.awaitMessages({
@@ -439,7 +441,7 @@ module.exports = {
const userCheck = await fetch(mojangAPI + answer1_1)
const uuid = userCheck.data.id
fs.writeFile(`./applications/${user.id}`, uuid, function (err) {
fs.writeFile(`./apps/guild/${user.id}`, uuid, function (err) {
if (err) throw err;
});

View File

@@ -21,7 +21,7 @@ module.exports = {
await applicant.send({
embeds: [{
description: `Your application for the Illegitimate guild has been accepted.`,
description: `Your application for the Illegitimate guild has been accepted.`,
color: embedColor
}]
});
@@ -61,7 +61,7 @@ module.exports = {
});
await interaction.reply({
await interaction.editReply({
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.**",
@@ -78,7 +78,7 @@ module.exports = {
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("applicationdelete")
.setLabel("Delete Channel")
.setLabel("Delete channel")
.setStyle(ButtonStyle.Danger)
)
]