Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

343
Vistas
Discord JS, my users are able to create unlimited ticket channels when they react to the emoji

Users are able to create unlimited ticket channels when they react on 🎫 this emoji, what part do I miss in my script so that users are only able to create one ticket until they close it again?

My bots ID below is: 701327880046510080

Any help would be appreciated! :)

bot.on('messageReactionAdd', async (reaction, user, channel) => {
        if(user.partial) await user.fetch();
        if(reaction.partial) await reaction.fetch();
        if(reaction.message.partial) await reaction.message.fetch();
        if(user.bot) return;
        
        let ticketid = await settings.get(`${reaction.message.guild.id}-ticket`);
        
        if(!ticketid) return;
        
        
        if(reaction.message.id == ticketid && reaction.emoji.name == '🎫') {
            reaction.users.remove(user);
            const ticketChannel = reaction.message.guild.channels.cache.find(chan => chan.name === `ticket-${user.username}`)
            if (ticketChannel) return;
            reaction.message.guild.channels.create(`ticket-${user.username}`, {
                parent: '701254271861260389',
                position: 1,
                permissionOverwrites: [
                    {
                        id: '701327880046510080',
                        allow: ["MANAGE_CHANNELS", "MANAGE_GUILD", "MANAGE_ROLES", "MANAGE_EMOJIS", "READ_MESSAGE_HISTORY", "MANAGE_MESSAGES", "SEND_MESSAGES", "VIEW_CHANNEL"]
                    },
                    {
                        id: user.id,
                        allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"]
                    },
                    {
                        id: reaction.message.guild.roles.everyone,
                        deny: ["VIEW_CHANNEL"]
                    },
                    {
                        id: '306893721725829121',
                        allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"]
                    }
                ],
                type: 'text'
            }).then(async channel => {
                EMBED STUFF ..irrelevant. <-ignore this
                send.react("🔒")
            })
        }
        if(reaction.emoji.name == '🔒'){
            if(!reaction.message.channel.name.includes("ticket-")) return;
            reaction.users.remove(user);
            
            reaction.message.channel.delete()
        }
    })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Add these lines to your code

bot.on('messageReactionAdd', async (reaction, user, channel) => {
        if(user.partial) await user.fetch();
        if(reaction.partial) await reaction.fetch();
        if(reaction.message.partial) await reaction.message.fetch();
        if(user.bot) return;
        
        let ticketid = await settings.get(`${reaction.message.guild.id}-ticket`);
        
        if(!ticketid) return;

// add below here        
        const existing = bot.channels.cache.find(c => c.name === `ticket-${user.username}`)

        if (existing) {
            return reaction.message.reply({
                content: `You already have a ticket open, please close it first before creating a new one. See the ${existing} channel`
            });
        }
// add above here

// rest of code
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda