Please describe the problem you are having in as much detail as possible:
It beens few weeks that I am not receiving User Update event when using Gateway Intents.
Include a reproducible code sample here, if possible:
Here is my intents set up code but as User Update event is a passthrough I should still receive it.
const { Intents } = require('discord.js');
const intents = new Intents();
intents.add([
'GUILDS',
'GUILD_MEMBERS',
'GUILD_BANS',
'GUILD_EMOJIS',
'GUILD_WEBHOOKS',
'GUILD_VOICE_STATES',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS',
'DIRECT_MESSAGES',
'DIRECT_MESSAGE_REACTIONS'
]);
[...]
client.on('userUpdate', (oUser, nUser) => {
console.log(nUser);
});
Note that using eval to execute a bot.emit('userUpdate') works.
Further details:
I do not know if that is the fix but maybe you can try it out. I was wondering why my user cache was only my bot on startup and found out that I would need the GUILD_PRESENCES intent to get those.
This might be the same in your case.
I do not know if that is the fix but maybe you can try it out. I was wondering why my user cache was only my bot on startup and found out that I would need the
GUILD_PRESENCESintent to get those.
This might be the same in your case.
Guild Presences is a privileged intent and I do not want to use it, this being said User Update event is not part of Gateway Intents and should still be received so I don't know.
I'm having the same exact issue
Main.ts
Main.on('userUpdate', function(oUser, nUser) {
NickSpamHandler.NickHandle(oUser, nUser)
})
NickSpamTask.ts
import Discord, { Message, MessageFlags, GuildMember, PartialUser } from 'discord.js'
import { Context } from '../Handler/Context';
import User from 'discord.js';
export class NickAntiRaid {
private messages : Message[];
private message: Message
private readonly prefix: string;
private
constructor(prefix: string) {
this.prefix = prefix
}
async NickHandle(oUser : Discord.User | Discord.PartialUser, nUser: Discord.User | Discord.PartialUser) {
console.log('Test')
}
}
Guild Presences is a privileged intent and I do not want to use it, this being said User Update event is not part of Gateway Intents and should still be received so I don't know.
If you want to use it or not is unfortunately not relevant, if you want the event you will need to get whitelisted or enable the restriction of 100 servers as detailed in the discord API documentation
userUpdate is synthesized by discord.js (line 13 below) internally and stems from presence updates, thus requires that intent.
The only other place user updates are handled from updates the client user
We can also trigger userUpdate from guild member updates, there's an open issue about it #4279
imo it would be best to trigger the event from all 3 discord events.
Most helpful comment
I'm having the same exact issue
Main.ts
NickSpamTask.ts