Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!