Updating to add defer reply
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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" +
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -10,6 +10,8 @@ module.exports = {
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
interaction.deferReply();
|
||||
|
||||
if (interaction.type !== InteractionType.ModalSubmit) return;
|
||||
if (interaction.customId !== "denyreasonbox") return;
|
||||
|
||||
@@ -19,7 +21,7 @@ module.exports = {
|
||||
const applicant = await guild.members.fetch(applicantId);
|
||||
const reason = interaction.fields.fields.get('denyreason').value || "No reason provided";
|
||||
const embedColor = Number(color.replace("#", "0x"));
|
||||
const filePath = path.join(__dirname, `../../applications/${applicantId}`);
|
||||
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
|
||||
|
||||
const dmMessage = new EmbedBuilder()
|
||||
.setDescription("Your application for the Illegitimate guild has been denied\n" +
|
||||
@@ -28,7 +30,7 @@ module.exports = {
|
||||
|
||||
await applicant.send({ embeds: [dmMessage] });
|
||||
|
||||
await interaction.reply({
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Application denied\n" +
|
||||
"Channel will be deleted in 5 seconds...",
|
||||
|
||||
Reference in New Issue
Block a user