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

215
Views
Discord.js v13 , Read status of users and give/remove roles

Im trying to make bot check status of users, when they have discord.gg/ or .gg/ on status give a role, and if they take it out remove it

client.on('presenceUpdate', async (oldPresence, newPresence) => {
const role = newPresence.guild.roles.cache.get('910192386267840513');
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);
}});

This is the error it shows

    const activities = member.user.presence.activities[0];
                                        ^

TypeError: Cannot read properties of undefined (reading 'activities')
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Users no longer have presences. You will need to use the GuildMember to get the presence

const activities = member.presence.activities[0]
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!