Error [UNLOADED_PIECE]: The piece 'ready' does not exist.
Hello !
On this code :
I have this error:
When I remove
once
, it's working
Why?
Thanks!Solution:Jump to 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...
10 Replies
(My file name is ready.mjs)
over a year ago or so someone had a similar issue and we ended up fixing a bug but I can't recall what the cause was.
For starters:
1. Which version of
@sapphire/framework
are you using?
2. What's your file/folder structure?
3. Did you use the CLI to generate your bot?
4. What's your main
(CJS) or module
(ESM) property in package.json
5. Are you using TypeScript? And if so, how are you compiling and running your code? That is to say, what are your build and startup scripts?
- Did you remove your output folder and rebuild then try again?
6. Is your problem related to message commands? Did you add loadMessageCommandListeners
to your SapphireClient
options
Remember that if you are new to @sapphire/framework
it is important that you read the user guide.1) 5.0.7
2) It's :
3) No
4) It's my
src/index.mjs
5) No, JS
6) No, re'lated to a listeners
(I answer for Mathie, we work on the same bot)modular. Did you carefully follow the steps from https://sapphirejs.dev/docs/Guide/additional-information/implementing-a-discordpy-like-cog-system ? That is more than likely related.
Sapphire Framework
Implementing a discord.py like Cog system | Sapphire
Developer who come from the Python ecosystem may be familiar with the "[Cog]" system that discord.py has implemented.
Yes!
Others events work corectly
Okay, I get it: it's because I already have another event ready on once, for another module.
Can't I use two?
I'll probably need to don't use
once
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
it shoullddd work with "once" too
yup, i just tested it and it works withh once
It's ok for me, thank you!
ah yeah that does it. Good that you got it figured out.