Error [UNLOADED_PIECE]: The piece 'ready' does not exist.
Hello !
On this code :
import { Listener } from "@sapphire/framework";export class ReadyListeners extends Listener { constructor(context, options) { super(context, { ...options, once: true, }); } async run(client) { console.log("Are you readyy ?"); }}
import { Listener } from "@sapphire/framework";export class ReadyListeners extends Listener { constructor(context, options) { super(context, { ...options, once: true, }); } async run(client) { console.log("Are you readyy ?"); }}
I have this error:
1|common | Error [UNLOADED_PIECE]: The piece 'ready' does not exist.1|common | at _ListenerStore.resolve (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:207:15)1|common | at _ListenerStore.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:148:24)1|common | at ReadyListeners.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Piece.mjs:58:22)1|common | at ReadyListeners._runOnce (file:///home/mathie/node_modules/@sapphire/framework/dist/esm/lib/structures/Listener.mjs:29:16) {1|common | type: 'UNLOADED_PIECE'1|common | }
1|common | Error [UNLOADED_PIECE]: The piece 'ready' does not exist.1|common | at _ListenerStore.resolve (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:207:15)1|common | at _ListenerStore.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:148:24)1|common | at ReadyListeners.unload (file:///home/mathie/node_modules/@sapphire/pieces/dist/esm/lib/structures/Piece.mjs:58:22)1|common | at ReadyListeners._runOnce (file:///home/mathie/node_modules/@sapphire/framework/dist/esm/lib/structures/Listener.mjs:29:16) {1|common | type: 'UNLOADED_PIECE'1|common | }
When I remove
once
once
, it's working Why?
Thanks!
Solution
you can set a name for the events, so you can name them differently but you can set the "event" property the event you need still that way you can have multiple listeners for a single event