My code has been working just fine for weeks, but a few events and functions have randomly stopped working!
Firstly, my guildMemberAdd
, guildMemberRemove
, and guildMemberUpdate
events simply stopped doing anything. No errors are appearing, and when I debugged my code, I realized the event wasn't even being emitted when the corresponding action took place.
// const client = new Discord.Client();
client.on('guildMemberAdd', (member) => // not triggering!
client.channels.cache.get('channel-id').send(`${member.tag} joined!`); // not sending!
Secondly, when trying to get a member from the GuildMemberManager
cache, it always returns undefined
:
const member = message.guild.members.cache.get(targetID); // undefined
When I then tried to display every member in that guild's member cache, it only showed me and my bot instead of the usual 100+ members.
Then I tried to fetch every member in my guild using GuildMemberManager.fetch()
:
const members = await message.guild.members.fetch();
But I got this error:
[GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
Again, I'm sure my syntax is correct, as it's been working perfectly for a while, and I haven't updated anything recently that would affect this code.