Hi,
it seems that userUpdate fires more than just once, it fires the same amount of guilds in common. (This should be done by guildMemberUpdate, right?)
This seems like a bug, because after the first fire, oldUser and newUser don't differ anymore.
Also userUpdate fires on a user's presence update, but oldUser and newUser have the same presence set (the new presence).
Given the following code with 3 servers in common:
console.log(oldUser.presence.status);
console.log(newUser.presence.status);
console.log('---');
On a presence update, the output is:
idle
---
online
online
---
online
online
---
With the code modified to display the tag:
console.log(oldUser.tag);
console.log(newUser.tag);
console.log('---');
and a following username update, the output is:
testuser-1#9911
testuser#9911
---
testuser#9911
testuser#9911
---
testuser#9911
testuser#9911
---
Further details:
Fixed on e686c9a8166b14235060050962eae9b2b835e4c1, we can't do much for presences because technically, within the API, members have presences and not users.
Although I guess it technically is fixed since userUpdate now emits correctly, as now the presence will only change once.
Hmmm updating to the latest commit caused pm messages not to trigger the message event anymore and even the userUpdate event (tried with changing profile pic) :(
setGame is now setActivity.
I saw it in the docs, that's why I edited my message, sorry for that!
Okay, those two events not firing were my fault due to another api change...
userUpdate now fires correctly (tried changing nicks and profile pictures for testing guildMemberUpdate). However: It does not fire if a user sets his initial avatar or removes his/her avatar.
Further testing revealed that creating / changing / deleting the avatar triggers presenceUpdate
Fixed in the commit I just pushed, thanks for spotting this! 👍
Okay that fixed it, thanks! I assume that a fired presenceUpdate for changing the avatar is intentional?
Yep! All user changes also trigger a presenceUpdate.
Okay! Thanks for clarification 👍
Most helpful comment
I saw it in the docs, that's why I edited my message, sorry for that!