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

180
Visualizações
reading status and giving user role

I have a command that gives a user a role if they have .gg/ in their custom status. There are no error logs but the bot is not giving the role to the users who have this as their status.

client.on('presenceUpdate', async (oldPresence, newPresence) => {
    const role = newPresence.guild.roles.cache.get('726517660279373986');
    const member = newPresence.member;
    const activities = member.user.presence.activities[0];

    if (activities && (activities.state.includes('.gg/') || activities.state.includes('discord.gg/'))) {
        return newPresence.member.roles.add(role);
    }
    else if (member.roles.cache.get(role.id)) {
        newPresence.member.roles.remove(role);
    }
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Gateway Intents were introduced by Discord so bot developers can choose which events their bot receives based on which data it needs to function. Intents are named groups of pre-defined WebSocket events, which the discord.js client will receive.

You need the privileged GUILD_PRESENCE Intent to be enabled for setting up a functional presenceUpdate listener.

You may enable it by going to the Discord Developer Portal > Your Application > Bot > ( Scroll down and locate privileged intents ) > Turning on Presence intent.

This is what you'd be looking for:
here's what you're looking for

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