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

237
Views
Renew Bot Cache Discord.js v12

I have simple code, that checks if a user has an specific role:

message.member.roles.cache.some(role => role.id === 'role_id')

The problem is now, that when I change the roles, so remove the specific role while the bot is running, the user still has the rights. So in the Bot Cache, the user still has the specific role.

Is there any way to renew the bot cache when user roles change?

Thanks in advance

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

GuildMemberManager.fetch updates the cache. Simply do this above that statement:

await message.guild.members.fetch();
//rest of code with cached members
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!