Custom listener name not applying

RRhys12/6/2022
Hey, I'm looking to put multiple listeners into the same file and I'm running into an issue where the name option isn't applying As a quick reference, I am on the v14 PR although I believe it's unrelated Debugging steps I've tried: 1. Initializing the name field in the constructor 2. Initializing the name field in a decorator 3. After the constructor, ignoring the read only warning and attempting to set name to a custom name None of those have yielded successful results, when looking at it in a debugger and attempting to find the listener, it's using the file name Looking at the source code for https://github.com/sapphiredev/framework/blob/main/src/lib/structures/Listener.ts and https://github.com/sapphiredev/pieces/blob/main/src/lib/structures/Piece.ts it seems like there's nothing that should be preventing this custom name from being applied but it isn't, any ideas on what might be causing this / further debugging steps? Code:
export class SyncMessageDelete extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {
console.log(context, options);
super(context, {
...options,
event: "messageDelete",
name: "MessageDeletedWatcher",
});
}

public run(message: Message) {
console.log("Deleting message: ", message.id);
}
}
export class SyncMessageDelete extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {
console.log(context, options);
super(context, {
...options,
event: "messageDelete",
name: "MessageDeletedWatcher",
});
}

public run(message: Message) {
console.log("Deleting message: ", message.id);
}
}
const sync_delete = bot.client.stores
.get("listeners")
.find((listener) => listener.name === "MessageDeletedWatcher"); // fails to find with this name
const sync_delete = bot.client.stores
.get("listeners")
.find((listener) => listener.name === "MessageDeletedWatcher"); // fails to find with this name
Debugger screenshot:
Solution:
Looks like this was a caching issue with old files sticking around, not a bug
Jump to solution
Solution
RRhys12/6/2022
Looks like this was a caching issue with old files sticking around, not a bug
BBen12/6/2022
Out of curiosity and a bit off topic, why didn’t AO post the how to accept answers embed when this post was created?
RRhys12/6/2022
It’s afraid of me and stays away You better keep working or you’re going offline In actuality I’m not sure, I’ll have to debug that but it should have been created Rough guess is there may have been a long period of inactivity and some issue with the SQL connection so it didn’t get to check the server settings correctly - but nothing in the logs point to that
BBen12/6/2022
Ah that makes sense. I wasn’t sure if there was a way to opt out of getting those embeds if you already know how it works
RRhys12/6/2022
I’m going to put a “Dismiss” button on them so if the thread owner presses that it’ll go away

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
Precondition and InteractionHandlerHey, is there a way to add precondition to InteractionHandler ?Autocomplete handler not workingI made a interaction-handlers folder adjacent to my commands folder and have this code as a .ts fileHow can I use shardHello I want to use shard for my bot but the documentation say nothing about that, can you help me pSapphire keeps binding to portsI have created a sapphire bot using the CLI and it keeps binding to a port. How do I disable this?Movies & ShowsWe all love whiling the hours away watching movies and shows and we love discussing them, so we do tPets & Animals🐶's, 🐱's, 🐰's and other pets are super cute. Awe us with pictures of yours here!MusicTalk about all your favourite tunes here 🎶 🎙️ 🎵TechnologyWe all love technology and we can gush about it here. ``` 01010100 01100001 01101100 01101011 00100CodingUse this channel to talk about anything coding, be that Sapphire related or not.How to remove image from interaction reply when using a paginator?When my bot replies with an embed and then edit it's reply to a paginator the image what was in the Automatically delete a old slash command that has been renamed?How would I achieve this, I am using sapphire 3.1.3, and I want it to automatically delete the old oCommands won't be registeredI've currently only one slash command and one listener (for the ready event) but the listener won't sapphire type does not install on Node 19 [2]This is very weird when i tried using the `sapphire new` command, The same happens with npm too?Really need help that no body is willing tooI was wondering if someone could help me with making a modal. I have made the Modal, but i need helpWierd framewrk error..How to make custom sub commandI have error when try to make custom sub commandDetect HMR ReloadHey! Is there any way to detect when HMR https://www.npmjs.com/package/@sapphire/plugin-hmr has run ChannelTypes not detected as a difference in slash commandsIf you were to update a slash commands channel option's channel types, sapphire doesnt detect it andRefresh CommandsIs there a way to refresh all commands? I initially had some certain commands global, and then aftershapeshift's default with respect to surroundings```js s.object({ name: s.enum("A", "B"), other: s.object({ name: s.string }).default(/** if name