"This Interaction Failed" Error
The code functions as followed:
Once I do
The issues lies when the owner tries to click the button, it sends an "This interaction failed" error.
Here is my code:
Once I do
/blacklist-server add/blacklist-server add, the owner of the blacklisted server will receive an DM where then click a button and apply to be unblacklisted.The issues lies when the owner tries to click the button, it sends an "This interaction failed" error.
Here is my code:
const { Listener } = require('@sapphire/framework');
const {
Events,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
ButtonBuilder,
ButtonStyle,
ActionRowBuilder
} = require("discord.js");
const { color, emojis } = require('../../config');
const Guild = require('../../schemas/blacklistSchema');
class UserEvent extends Listener {
constructor(context, options = {}) {
super(context, {
...options
});
}
async run(interaction, client) {
if (interaction.customId !== "ban_appeal_modal") {
if (interaction.customId === "ban_appeal") {
const modal = new ModalBuilder()
.setCustomId('ban_appeal_modal')
.setTitle('Blacklist Appeal');
const Q1 = new TextInputBuilder()
.setCustomId('question_1')
.setLabel("Your ID")
.setStyle(TextInputStyle.Short);
const Q2 = new TextInputBuilder()
.setCustomId('question_2')
.setLabel("What was the reason for your blacklist?")
.setStyle(TextInputStyle.Short);
const Q3 = new TextInputBuilder()
.setCustomId('question_3')
.setLabel("Why do you think you should be unblacklisted?")
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(Q1);
const secondActionRow = new ActionRowBuilder().addComponents(Q2);
const thirdActionRow = new ActionRowBuilder().addComponents(Q3);
modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);
await interaction.showModal(modal);
}
if (interaction.customId === "blacklist_appeal_accept") {
const ownerId = interaction.guild.ownerId;
const owner = await client.users.fetch(ownerId);
const currentDate = new Date().toLocaleDateString();
await owner.send(`${emojis.custom.tada} Your blacklist appeal has been **accepted** on **${currentDate}**!`);
await interaction.reply({
content: `${emojis.custom.success} You have successfully **accepted** ${owner}'s blacklist appeal on **${currentDate}**!`,
ephemeral: true
});
}
if (interaction.customId === "blacklist_appeal_deny") {
const ownerId = interaction.guild.ownerId;
const owner = await client.users.fetch(ownerId);
const currentDate = new Date().toLocaleDateString();
await owner.send(`${emojis.custom.fail} Your blacklist appeal has been **denied** on **${currentDate}**!`);
await interaction.reply({
content: `${emojis.custom.success} You have successfully **denied** ${owner}'s blacklist appeal on **${currentDate}**!`,
ephemeral: true
});
}
}
}
};
module.exports = {
UserEvent
};const { Listener } = require('@sapphire/framework');
const {
Events,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
ButtonBuilder,
ButtonStyle,
ActionRowBuilder
} = require("discord.js");
const { color, emojis } = require('../../config');
const Guild = require('../../schemas/blacklistSchema');
class UserEvent extends Listener {
constructor(context, options = {}) {
super(context, {
...options
});
}
async run(interaction, client) {
if (interaction.customId !== "ban_appeal_modal") {
if (interaction.customId === "ban_appeal") {
const modal = new ModalBuilder()
.setCustomId('ban_appeal_modal')
.setTitle('Blacklist Appeal');
const Q1 = new TextInputBuilder()
.setCustomId('question_1')
.setLabel("Your ID")
.setStyle(TextInputStyle.Short);
const Q2 = new TextInputBuilder()
.setCustomId('question_2')
.setLabel("What was the reason for your blacklist?")
.setStyle(TextInputStyle.Short);
const Q3 = new TextInputBuilder()
.setCustomId('question_3')
.setLabel("Why do you think you should be unblacklisted?")
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(Q1);
const secondActionRow = new ActionRowBuilder().addComponents(Q2);
const thirdActionRow = new ActionRowBuilder().addComponents(Q3);
modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);
await interaction.showModal(modal);
}
if (interaction.customId === "blacklist_appeal_accept") {
const ownerId = interaction.guild.ownerId;
const owner = await client.users.fetch(ownerId);
const currentDate = new Date().toLocaleDateString();
await owner.send(`${emojis.custom.tada} Your blacklist appeal has been **accepted** on **${currentDate}**!`);
await interaction.reply({
content: `${emojis.custom.success} You have successfully **accepted** ${owner}'s blacklist appeal on **${currentDate}**!`,
ephemeral: true
});
}
if (interaction.customId === "blacklist_appeal_deny") {
const ownerId = interaction.guild.ownerId;
const owner = await client.users.fetch(ownerId);
const currentDate = new Date().toLocaleDateString();
await owner.send(`${emojis.custom.fail} Your blacklist appeal has been **denied** on **${currentDate}**!`);
await interaction.reply({
content: `${emojis.custom.success} You have successfully **denied** ${owner}'s blacklist appeal on **${currentDate}**!`,
ephemeral: true
});
}
}
}
};
module.exports = {
UserEvent
};