Pre messsage command run help
Hello, I wanted to run permission check before executing the command, returning the error message if failed otherwise continue with coommand. I can't get it to work and I can't understand why
13 Replies
Here's my current code and file name is
preMessageCommandRun
Client options ^^
This makes preconditions go away and also if the member has permission, real command logic never happensWhy are you overwriting the core event and not using global preconditions https://sapphirejs.dev/docs/Guide/preconditions/global-preconditions ?
Sapphire Framework
Global preconditions | Sapphire
Sometimes you want a precondition that automatically runs for every command, without having to add it to each command.
Sorry😭
Thanks
They are executed in every command, right? I don’t have to specify them
yes
i don't really understand
position
property
I did this:
and it works okay, but is 20 normal or what shoild I putit's abitrary if you only have 1
I think enabled is 0 so just anything above 0
can be steps of 10s, 1s, 100s, 5s, whatever
is that working with subcommands? cuz it wont work for me so idk did i made a mistake or what happened
The parent command should get blocked I think
@Favna can I do something like this but for interaction handlers?
I want a function to be called before interaction handler is
no for that you will have to overwrite the core listener
Which core listener
There is no like PreInteractionHandlerRun
Or I can’t see it
GitHub
framework/src/listeners/application-commands/CorePossibleAutocomple...
Discord bot framework built on top of discord.js for advanced and amazing bots. - sapphiredev/framework
But uhm
Depending on what you want to do
It might be better to just call a function in the parse method
Or extend the interactionhandler class and do something that way
(the latter opens many doors)