Hey there! I need some help with my discord bot. I'm trying to get a list of members ordered by their ids, but when I run the code below, all it does is log "Couldn't fetch members" without any other errors showing up.
After digging deeper, I realized that it's actually a timeout error. Everything seems to be fine otherwise, and I don't think the issue lies with the const guild. Hopefully, someone can assist me on this. Cheers!
const IDs = new Map();
var repeat = new Boolean(false);
var randomInt = new Number(0);
client.on('ready', () => {
console.log('Ready!');
const guild = client.guilds.cache.get("xxxxxxxxxxxxxxxxxx");
guild.members.fetch().then(members => {
console.log("Found the members");
IDs = members.map(user => user.id);
const OnlineMembers = members.filter(member => member.presence.status == "online");
}).catch(e => console.log("Couldn't fetch members."));
});
P.S. This code is running on a Raspberry Pi using Nodemon --inspect, in case that makes a difference