How to use preconditions properly?

Hi, im a new at sapphire and didn't know much about it, also i was reading the Docs that how to use Preconditions and how to handle failure on it. The question is, i was following the same thing at the docs but there is nothing show when i console.log it, im using ESM JavaScript not TypeScript. also, can someone explain how does Preconditions work? and what make it triggered on Listener event?
9 Replies
Oreo ™
Oreo ™4mo ago
Something I noticed is that you're not actually listening to the event, you either need to make the file name the event names or provide the event name in the options inside the constructor.
1intan99
1intan994mo ago
I see, so i need to make it same as Precondition that i made?
Oreo ™
Oreo ™4mo ago
No
Oreo ™
Oreo ™4mo ago
Sapphire Framework
Creating your own listeners | Sapphire
Similar to what you learned in both Creating Commands and [Creating
Oreo ™
Oreo ™4mo ago
Preconditions emit an event called messageCommandDenied And you need to listen to that
Oreo ™
Oreo ™4mo ago
GitHub
skyra/src/listeners/commands/messageCommandDenied.ts at main · skyr...
A multipurpose Discord Bot designed to carry out most of your server's needs with great performance and stability. - skyra-project/skyra
Oreo ™
Oreo ™4mo ago
Basically you need to add a constructor to your class and add the option to listen to messageCommandDenied or name the filename to messageCommandDenied
1intan99
1intan994mo ago
ooh, yes, i see thank you very much it work when i change the filename to messageCommandDenied once again, thank you so much
Oreo ™
Oreo ™4mo ago
Np
Want results from more Discord servers?
Add your server