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

143
Views
TypeError: Cannot read properties of undefined (reading 'members') discord js

In my bot, I constantly get an error that it does not see participants

const client = new Discord.Client({
    intents: new Discord.Intents(32767)
})
const guild = client.guilds.cache.get('909512069999628349'); 

client.on('ready', () =>   
{
    guild.members.fetch()
    .then(console.log)
    .catch(console.error);
});

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

0

Your bot is not being logged into Discord before the guild is attempted to be fetched. It's simple. Just move the const guild inside the Ready event, or use a hack similar to this:

let guild;
client.on('ready', () => {
  guild = client.guilds.cache.get('id')
about 4 years ago · Juan Pablo Isaza Report

0

Try using members?.fetch(), probably your object might be undefined so do this instead

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!