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

199
Visualizações
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 Respostas
Responde à pergunta

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 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