PreMessageCommandRun help
This is my pre event:
and the handler:
But when i ran the command, both executed

Solution:Jump to solution
Then make it a global precondition (https://sapphirejs.dev/docs/Guide/preconditions/global-preconditions) or extend the Command class and add it as default options (https://github.com/favware/xiveventbuddy/blob/main/src/lib/extensions/XIVEventBuddyComand.ts)
Sapphire Framework
Global preconditions | Sapphire
Sometimes you want a precondition that automatically runs for every command, without having to add it to each command.
GitHub
xiveventbuddy/src/lib/extensions/XIVEventBuddyComand.ts at main · ...
A user friendly first discord bot to host your XIV events - favware/xiveventbuddy
7 Replies
@kyra ><
@vladdy :<
No idea what gave you the idea to add an event to PreMessageCommandRun but
1. You're supposed to use preconditions https://www.sapphirejs.dev/docs/Guide/preconditions/what-are-preconditions
2. In JavaScript having multiple listeners on the same event will trigger all of them in parallel, not in sequence
3. You're not overwriting the core file because yours doesnt have the same name
4. No idea where you're getting ExtendedUserError from but you're never throwing it so the error will never be that type
Also please do not ping people like that. We will get to your questions when we have time. Timezones exist if you didn't know and we cannot be active 24/7
We also have post guidelines that ask you to ping helpers, not individual people: https://i.imgur.com/fIVnJ1p.png
Sapphire Framework
What are preconditions and how do they work? | Sapphire
Preconditions are classes that will determine whether or not a command should be ran according to certain conditions.
I'm sorry for all of that
btw i want to make a handler for only execute command executed in my server
But not using precondition
why not?
I have many commands, and i want to build this as a template
Solution
Then make it a global precondition (https://sapphirejs.dev/docs/Guide/preconditions/global-preconditions) or extend the Command class and add it as default options (https://github.com/favware/xiveventbuddy/blob/main/src/lib/extensions/XIVEventBuddyComand.ts)
Sapphire Framework
Global preconditions | Sapphire
Sometimes you want a precondition that automatically runs for every command, without having to add it to each command.
GitHub
xiveventbuddy/src/lib/extensions/XIVEventBuddyComand.ts at main · ...
A user friendly first discord bot to host your XIV events - favware/xiveventbuddy
Ahh, ty