Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
Discord.js creating ticket when pressed reaction on embed not working

I'm trying to make a ticket system for my discord bot but I can't figure out why excatly this part of code isn't working. I'm using discord.js v13.

So basically I have made this embed with reaction which is meant to be pressed and bot creates new text channel.

Image

And here is my code for creating new ticket after pressing reaction on embed:

client.on('messageReactionAdd', async (reaction, user) => {
    if(user.partial) await user.fetch();
    if(reaction.partial) await reaction.fetch();
    if(reaction.message.partial) await reaction.message.fetch();

    if(user.bot) return;

    const ticketid = await settings.get(`${reaction.message.guild.id}-ticket`);

    if(!ticketid) return;

    if(reaction.message.id == ticketid && reaction.emoji.name == '🎫') {
        reaction.users.remove(user);

        reaction.message.guild.channels.create(`ticket-${user.username}`, {
            permissionOverwrites: [
                {
                    id: user.id,
                    allow: ["SEND_MESSAGES", "VIEW_CHANNEL"]
                },
                {
                    id: reaction.message.guild.roles.everyone,
                    deny: ["VIEW_CHANNEL"]
                }
            ],
            type: 'text'
        }).then(async channel => {
            channel.send({ embeds: [new MessageEmbed().setTitle("Sveicināts `<@${user.id}>`!").setDescription("Lai saņemtu palīdzību raksti šajā kanālā.").setColor("FFFA33")] })
        })
    }
});

Can someone please help me, I've been trying to make this work for days now.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you need to use collector https://discord.js.org/#/docs/main/stable/class/Collector or check the guide https://discordjs.guide/popular-topics/collectors.html#basic-reaction-collector

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda