presenceUpdate not emitting

So basically presenceUpdate wont fire if i have user caches disabled which makes it fail to get user and not send, but now i have enabled cached and have set sweepers to clear that cache every hour so it can refill again, but for some reason, client emits events before the sweepers runs, after it runs, no more events come in? im not sure what that sweeper does but like why does it prevent cache from refilling? i wouldn't really want to have all caches full just to get user's current presence
No description
No description
No description
14 Replies
d.js toolkit
d.js toolkit5d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Whimsy
WhimsyOP5d ago
i triple checked this please @ me
monbrey
monbrey5d ago
You likely will want to enable partials for GuildMember so that events can emit for uncached entities
Whimsy
WhimsyOP4d ago
i tried that when i had caches disabled and it didnt do anything ngl seems like i had them whole this time on anyway so yeah partials dont work in this case
monbrey
monbrey4d ago
Partial user too?
Whimsy
WhimsyOP4d ago
yes
Whimsy
WhimsyOP4d ago
No description
monbrey
monbrey4d ago
hmm, Im not sure
Whimsy
WhimsyOP4d ago
i mean as you can see in first image, from my understanding, if i have cache disabled or smth, then it can't add user, and then it returns on 3rd line, maybe there should be also check like if (!user && !this.client.partials.includes(Partials.User)) return; or at that point if that wont be added or suggested should i just listen to raw and switch op code
monbrey
monbrey4d ago
nah I agree, thats what partials are intended for unless your presence cache is also 0?
Whimsy
WhimsyOP4d ago
its not never was
Whimsy
WhimsyOP4d ago
my config
No description
Whimsy
WhimsyOP4d ago
after 1h (3600s), no presence events come trough its for sure little weird behavior ill try to play around with source code
NyR
NyR4d ago
there's certainly an issue, but the issue is not that _add doesn't return anything. Discord sends partial user (only id) for any presence update except going from offline to any other, so this check fails if (!user && data.user.username) as data.user.username doesn't exist resulting in user being undefined if caching is disabled. This should be handled differently accounting for partials yes

Did you find this page helpful?