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

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

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