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

194
Views
Discord js v12 Add rights to a channel if user reacts to a specific message

I have a problem that I can't solve: Every time someone reacts to a specific message a channel gets created, and then the person who reacted first is the only one who has the permissions to see this channel. I set the max amount of reactions to "2", and I want it so that the second person who reacts with the message also gets permissions to see the created channel, but I don't know how to do it. Does somebody has an example? This is what I currently have:

 message.guild.channels.create("Busfahrer", {
                    type: "text",
                    parent: category,
                    permissionOverwrites: [
                        {
                            id: message.guild.id,
                            allow: ['SEND_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY'],
                            deny: ['VIEW_CHANNEL'],                                
                        }
                    ]
                })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Keep track of who reacts first and second and only give it to the second person:

const collector = reactionMessage2p.createReactionCollector(filter2p, {max: 2, time: 20000, errors: ['time'] })
let reactedUsers = []

collector.on("collect", (reaction, user) => {
  reactedUsers.push(user.id)
})

collector.on("end", async () => {
  let targetUser = reactedUsers[1]
  // channel is the channel you create
  channel.updateOverwrite(targetUser, {
    VIEW_CHANNEL: true
  })
})

I got some of this code from your other question

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!