GuildMemberRemove not running

I just think I'm overlooking something but... I'm trying to do something if a member leaves the guild, but the event is not running. I have the following intends: - Guilds - GuildMembers - GuildPresences I also added the partial "GuildMember". The Listener looks like this:
export class SomeListener extends Listener<typeof Events.GuildMemberRemove> {
public async run(member: GuildMember) {
console.log('TEST');
}
}
export class SomeListener extends Listener<typeof Events.GuildMemberRemove> {
public async run(member: GuildMember) {
console.log('TEST');
}
}
6 Replies
Lioness100
Lioness10015mo ago
@senpai.peace in your main file, before you login, import Store from @sapphire/framework, then add the line Store.logger = console.log. Then, check the logs to make sure the listener is loading correctly.
Peace
PeaceOP15mo ago
Are this the right lines?
[INSERT] Loaded new piece 'someListener'.
[INSERT] Inserted new piece 'someListener'.
[INSERT] Loaded new piece 'someListener'.
[INSERT] Inserted new piece 'someListener'.
Lioness100
Lioness10015mo ago
It looks like you didn't name the listener correctly. The file should be named guildMemberRemove.ts
Peace
PeaceOP15mo ago
Oh wow, that was it... Thought the file naming is unimportant as long as you set the Events.GuildMemberRemove. Thanks
Lioness100
Lioness10015mo ago
You're welcome. Unfortunately sapphire doesn't read types. You can either set the event name through the file name or the event field in the constructor.
Favna
Favna15mo ago
Adding to this, sapphire couldn't read types even if it wanted to (it would be cool) because type information is lost when compiling. The only way this could maybe be achieved is with a tsconfig plugin but I have no idea how those work. Or have a dedicated CLI like Prisma does. Sadly typescript isn't like Java Spring Boot where you can provide only the interface for a database repository and it automatically implements a whole CRUD repository.
Want results from more Discord servers?
Add your server