Bot Discord V14 - Ticket System

Hi, I'm working on a ticketing system, including ticket management (deleting, closing...). I'm making a transfer system and I'm using a collector but it won't pick me up.
if (interaction.customId === "transfer_ticket") {
const embed = new EmbedBuilder()
.setColor("Aqua")
.setDescription("Choississez dans le selecteur ci-dessous le pôle où le ticket doit-être envoyé")

const row = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId('pole')
.setPlaceholder('Choisissez le pôle de transfert')
.addOptions(
{
label: 'Equipe d\'administration',
value: 'Equipe d\'administration',
},
{
label: 'Equipe de modération',
value: 'Equipe de modération',
},
{
label: 'Equipe marketing',
value: 'Equipe marketing',
},
{
label: 'Equipe commerciale',
value: 'Equipe commercial',
},
),
);
try {
const message = await interaction.reply({ embeds: [embed], components: [row], ephemeral: true });

const filter = i => i.customId === 'pole';
message.awaitMessageComponent({ filter, time: 60000 }) // 60 secondes
.then(interaction => {
console.log('Interaction reçue:', interaction.values[0]); // C'est ici que vous pouvez traiter la valeur sélectionnée
})
.catch(err => console.log('Aucune interaction collectée.'));

} catch (error) {
console.error("Erreur lors de la réponse :", error);
}

}
if (interaction.customId === "transfer_ticket") {
const embed = new EmbedBuilder()
.setColor("Aqua")
.setDescription("Choississez dans le selecteur ci-dessous le pôle où le ticket doit-être envoyé")

const row = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId('pole')
.setPlaceholder('Choisissez le pôle de transfert')
.addOptions(
{
label: 'Equipe d\'administration',
value: 'Equipe d\'administration',
},
{
label: 'Equipe de modération',
value: 'Equipe de modération',
},
{
label: 'Equipe marketing',
value: 'Equipe marketing',
},
{
label: 'Equipe commerciale',
value: 'Equipe commercial',
},
),
);
try {
const message = await interaction.reply({ embeds: [embed], components: [row], ephemeral: true });

const filter = i => i.customId === 'pole';
message.awaitMessageComponent({ filter, time: 60000 }) // 60 secondes
.then(interaction => {
console.log('Interaction reçue:', interaction.values[0]); // C'est ici que vous pouvez traiter la valeur sélectionnée
})
.catch(err => console.log('Aucune interaction collectée.'));

} catch (error) {
console.error("Erreur lors de la réponse :", error);
}

}
9 Replies
d.js toolkit
d.js toolkit17mo 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!
treble/luna
treble/luna17mo ago
add fetchReply: true when replying
ITcomputing
ITcomputingOP17mo ago
Where ?
treble/luna
treble/luna17mo ago
where you reply to the interaction
ITcomputing
ITcomputingOP17mo ago
const message = await interaction.fetchReply({ embeds: [embed], components: [row], ephemeral: true });
const message = await interaction.fetchReply({ embeds: [embed], components: [row], ephemeral: true });
?
treble/luna
treble/luna17mo ago
no pass it in in your object
ITcomputing
ITcomputingOP17mo ago
Oh okey
const message = await interaction.reply({ embeds: [embed], components: [row], ephemeral: true, fetchReply:true });
const message = await interaction.reply({ embeds: [embed], components: [row], ephemeral: true, fetchReply:true });
treble/luna
treble/luna17mo ago
yes
ITcomputing
ITcomputingOP17mo ago
Ohhhh Thanks !!!!! I'd been looking for 3 days!
Want results from more Discord servers?
Add your server