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

1.6K
Visualizações
discord.js How to check if the bot has permissions from server/channel?

I want to check two things

  1. Check if I have a specific SERVER permission for my bot (return true/false depending if it has that permission)
  2. Check if I have a specific CHANNEL permission for my bot (return true/false depending on the value of the channel settings that has included my bot a specific permission. E.g I might have added my bot in the channel settings and set the "MANAGE SERVER" permission to true. How can I read that?)
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Found it! To find the bot's permissions, let's say, after a message (msg =>) was sent by a user:

CHANNEL permission:

msg.guild.me.permissionsIn(msg.channel).has(<permission string here>)

SERVER permission

msg.guild.me.hasPermission(<permission string here>)
over 4 years ago · Santiago Trujillo Relatório

0

LDinos' answer is correct for Discord.js v12. However, Discord.js v13 removed the hasPermission permission in favour of permissions.has.

Channel permissions:

msg.guild.me.permissionsIn(msg.channel).has(permissions)

Guild (server) permissions:

msg.guild.me.permissions.has(permissions)
over 4 years ago · Santiago Trujillo 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