This interaction failed

const handleTicketCloseButtonClick = async (interaction) => {
console.log('Нажата кнопка Закрыть тикет');
try {
const ticketChannelId = interaction.message.channel.id;

const ticketChannel = await interaction.guild.channels.cache.get(ticketChannelId);

if (ticketChannel) {
await ticketChannel.delete();
console.log('Секретный чат успешно удален');

} else {
console.error('Не удалось найти тикет-канал для удаления.');
}
} catch (error) {
console.error('Произошла ошибка при удалении секретного чата:', error);
}
};
const handleTicketCloseButtonClick = async (interaction) => {
console.log('Нажата кнопка Закрыть тикет');
try {
const ticketChannelId = interaction.message.channel.id;

const ticketChannel = await interaction.guild.channels.cache.get(ticketChannelId);

if (ticketChannel) {
await ticketChannel.delete();
console.log('Секретный чат успешно удален');

} else {
console.error('Не удалось найти тикет-канал для удаления.');
}
} catch (error) {
console.error('Произошла ошибка при удалении секретного чата:', error);
}
};
5 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
duck
duck8mo ago
interactions need responses in order to not be considered failed I don't see any code that actually responds to the interaction here
d.js docs
d.js docs8mo ago
Responding to interactions: - #reply immediately respond with a message - #update immediately update the original message (buttons, select menus) - #showModal immediately show a modal (cannot be deferred) - #deferReply/Update respond later (up to 15 minutes) - #followUp post an additional message The initial response has to happen within 3s of receiving the interaction!
Martoz
MartozOP8mo ago
collector.on('collect', async (interaction) => {
if (interaction.customId === 'create_ticket') {
await handleCreateTicketButtonClick(interaction, ticketChannel);
} else if (interaction.customId === 'close_ticket') {
await handleTicketCloseButtonClick(interaction, ticketChannel);
}
});
collector.on('collect', async (interaction) => {
if (interaction.customId === 'create_ticket') {
await handleCreateTicketButtonClick(interaction, ticketChannel);
} else if (interaction.customId === 'close_ticket') {
await handleTicketCloseButtonClick(interaction, ticketChannel);
}
});
const createCloseButtonRow = () => {
return new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('close_ticket')
.setLabel('Close')
.setStyle('DANGER')
);
};
const createCloseButtonRow = () => {
return new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('close_ticket')
.setLabel('Close')
.setStyle('DANGER')
);
};
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server