#No duplicate tickets in discord.js

1 messages · Page 1 of 1 (latest)

shrewd flare

I want to make my bot to not create another ticket if there is an open ticket by the user requesting this action.

    const ticketCategory = interaction.guild.channels.cache.find((c) => c.id === "1052297483952345159");

    let existingChannel = interaction.guild.channels.cache.find(c => c.name = `Ticket-${interaction.user.discriminator}`);
    if (existingChannel) {
      return interaction.reply({ content: '❌ There is already a Ticket opened by you!', ephemeral: true });
    } else {
        return interaction.reply('test')
    }