Code:
} else if (interaction.customId == "close-ticket") {
const guild = client.guilds.cache.get(interaction.guildId);
const chan = guild.channels.cache.get(interaction.channelId);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('confirm-close')
.setLabel('Κλείσε το ticket!')
.setStyle(ButtonStyle.Danger),
new ButtonBuilder()
.setCustomId('no')
.setLabel('Ακύρωση!')
.setStyle(ButtonStyle.Secondary),
);
const verif = await interaction.reply({
content: 'Είστε βέβαιοι ότι θέλετε να κλείσετε το ticket σας;',
components: [row]
});
const collector = interaction.channel.createMessageComponentCollector({
componentType: 'BUTTON',
time: 10000
});
collector.on('collect', i => {
if (i.customId == 'confirm-close') {
interaction.editReply({
content: `Το ticket έκλεισε απο τον/την: <@!${interaction.user.id}>`,
components: []
});
chan.edit({
name: `closed-${chan.name}`,
permissionOverwrites: [
{
id: client.users.cache.get(chan.topic),
deny: [PermissionsBitField.Flags.ViewChannel],
},
{
id: config.rolesupport,
allow: [PermissionsBitField.Flags.ViewChannel],
},
{
id: interaction.guild.roles.everyone,
deny: [PermissionsBitField.Flags.ViewChannel],
},
],
})
.then(async () => {
const embed = new client.discord.MessageEmbed()
.setColor('#429cf5')
.setAuthor('Ticket', `${client.config.serverlogo}`)
.setDescription('Πατήστε το `️Διαγραφή του ticket!`, για να διαγράψετε το ticket!')
.setFooter(`${client.config.servername}`, `${client.config.serverlogo}`)
.setTimestamp();
const row = new client.discord.MessageActionRow()
.addComponents(
new client.discord.MessageButton()
.setCustomId('delete-ticket')
.setLabel('Διαγραφή του ticket!')
.setEmoji('️')
.setStyle('DANGER'),
);
chan.send({
embeds: [embed],
components: [row]
});
});
collector.stop();
};
if (interaction.customId == 'no') {
interaction.reply({
content: 'Η κατάργηση του ticket σας ακυρώθηκε !',
components: []
});
collector.stop();
};
});
collector.on('end', (interaction) => {
if (interaction.size < 1) {
interaction.reply({
content: 'Η κατάργηση του ticket σας ακυρώθηκε !',
components: []
});
};
});
Error:
interaction.reply({
^
TypeError: interaction.reply is not a function
So.. what is the new function to update an interaction reply ? Can somebody send a fix version of this code or suggest me a fix ? Thanks in advance :)
(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)(Idk what extra detail i should add)
There are some issues. What you are likely running into is you are redefining
interactionand hiding the original:In the above code,
interactionis no longer the discord interaction, but some other object or value. My guess is you wanted something like:You have a similar issue above, where you check
if (interaction.customId == 'no') {That will never be "no" (barring some unexpected api that modifies it external to your code), because you are in an if statement that already determined it is "close-ticket". You probably wanted:
if (i.customId == 'no') {