guildMemberUpdate event

I'm trying to create a listener for the guildMemberUpdate event, and sapphire registers this listener, but the run is never executed Code:
import { Listener } from '@sapphire/framework';
import type {GuildMember} from "discord.js";

export class GuildMemberUpdateListener extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {
super(context, {
...options,
once: true,
event: 'guildMemberUpdate'
});
}

public run(oldMember: GuildMember, newMember: GuildMember) {
console.log("Old member:" + oldMember);
console.log("New member:" + newMember);
}
}
import { Listener } from '@sapphire/framework';
import type {GuildMember} from "discord.js";

export class GuildMemberUpdateListener extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {
super(context, {
...options,
once: true,
event: 'guildMemberUpdate'
});
}

public run(oldMember: GuildMember, newMember: GuildMember) {
console.log("Old member:" + oldMember);
console.log("New member:" + newMember);
}
}
Solution:
remove once: true, otherwise it gets de-registered after a single call. Also make sure you have the proper intent in your client options...
Jump to solution
6 Replies
Solution
Favna
Favna2y ago
remove once: true, otherwise it gets de-registered after a single call. Also make sure you have the proper intent in your client options
at0moncord
at0moncordOP2y ago
I removed the once:true and checked my intents, and the run is still never executed
Favna
Favna2y ago
in that case:
Spinel
Spinel2y ago
- Which version of @sapphire/framework are you using? - What's your file/folder structure? - Did you use the CLI to generate your bot? - What's your "main" property in package.json - Are you using TypeScript? And if so, how are you compiling and running your code? That is to say, what are your build and startup scripts? - In case you are using version 3.0.0 or higher of @sapphire/framework, and your problem related to message commands, did you add loadMessageCommandListeners to your SapphireClient options Remember that if you are new to @sapphire/framework it is important that you read the user guide.
at0moncord
at0moncordOP2y ago
I think my bot just had a massive lag spike because the event logged after like 30s thank you for your help @favna
Favna
Favna2y ago
oh that's unfortunate but glad it works now
Want results from more Discord servers?
Add your server