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);
});
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')
Try using members?.fetch(), probably your object might be undefined so do this instead