Custom listener name not applying

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
5 Replies
Solution
Rhys
Rhys2y ago
Looks like this was a caching issue with old files sticking around, not a bug
Ben
Ben2y ago
Out of curiosity and a bit off topic, why didn’t AO post the how to accept answers embed when this post was created?
Rhys
Rhys2y ago
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
Ben
Ben2y ago
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
Rhys
Rhys2y ago
I’m going to put a “Dismiss” button on them so if the thread owner presses that it’ll go away
Want results from more Discord servers?
Add your server