Custom Events not Creating Listeners
I'm having issues using Sapphire with custom events. For example, I have an event for when a member subscribes to a role:
Then, in another Sapphire listener:
My issue is that with custom named events, Sapphire doesn't seem to register all of them. For example, I'll have
I thought maybe I'd have to increase the max listeners for the client, but that also doesn't work.
Any ideas?
Then, in another Sapphire listener:
My issue is that with custom named events, Sapphire doesn't seem to register all of them. For example, I'll have
guildMemberDemoted, guildMemberPromoted, guildMemberSubscribed, and guildMemberUnsubscribed.guildMemberDemoted will fire off, but guildMemberPromoted does not. If I check the client for a guildMemberPromoted listener, none exists.I thought maybe I'd have to increase the max listeners for the client, but that also doesn't work.
Any ideas?
Solution
https://github.com/skyra-project/skyra/blob/main/src/listeners/guilds/members/notMutedMemberAddInitialRole.ts
https://github.com/skyra-project/skyra/blob/main/src/listeners/guilds/members/guildMemberAdd.ts#L15
Custom events should work just fine. Make sure your emits are actually called and you do not have duplicate file names. By default the name of the file is used as the piece name, and the piece name has to be unique because we use a Map which has unique keys https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
https://github.com/skyra-project/skyra/blob/main/src/listeners/guilds/members/guildMemberAdd.ts#L15
Custom events should work just fine. Make sure your emits are actually called and you do not have duplicate file names. By default the name of the file is used as the piece name, and the piece name has to be unique because we use a Map which has unique keys https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map