#User and Guild Member Updates

1 messages · Page 1 of 1 (latest)

native rapids
#

Okay so

#

Discord only emits User Update when the bot user changes. It normally doesn't emit for any others users.

#

Instead, Discord emits every change as a Guild Member Update.

#

discord.js looks at that event, and decided which it should be emitted from. If the data changed is guild specific data (like a nickname) it emits a guildMemberUpdate event in that guild

#

If the data changed is a username, it emits a userUpdate instead of duplicating the event across all guilds

#

If you want to listen to the original raw event that Discord sends, you can do that with client.ws.on("GUILD_MEMBER_UPDATE", member =>

#

You wont get the old member though, only the new details

vital mason
#

thanks, that helps to clear it up a lot. I've had some success now with getting userUpdate to actually return values now

vital mason
#

as in, with a discord.js events emitted solution, besides relying on the websocket one

native rapids
#

Not currently

vital mason
#

Alright, thank you for your help. One last question although it's much more general, I'm using the d.js guides event handler, is there any way I can register the web socket events to that?

index.js

for (const file of eventFiles) {
    const filePath = path.join(eventsPath, file);
    const event = require(filePath);
    if (event.once) {
        client.once(event.name, (...args) => event.execute(...args));
    }
    else {
        client.on(event.name, (...args) => event.execute(...args));
    }
}
native rapids
#

It could be adapted. Either by querying a different folder, or by setting a event.ws = true kinda flag to bind to something else