Preconditions with missing handlers! What do?
Preconditions: What should happen with preconditions (global or not) that need to run on a message command but do not have a handler for them? Skip? Throw error?
43 Replies
Maybe skip them till you add preconditions for slashies?
Not the question at hand
can you define an example?
Preconditions will happen across the board, the question is what should happen if a command that can run both via / and message receives a precondition that only handles /
skip
means you could define everything in 1 array
buuut
but should it be skipped
Or should it throw an error
Maybe throw an ephermal message?
As error
Not doing user responses for them
Ah
We don't even have an in-chat error message by default
IMO
skipping them means you have to deal with mixed preconditions (slashes and messages)
which can result in either nasty nested arrays, or w/e
I mean we do handle it
On commandDenied
There is no listener for commandDenied included by default
So just like how normal preconditions work would be OK ish
Erhm
I'm also not talking about the preconditions array
But running the preconditions specified
Maybe throwing an error could be helpful
can you define an example? I still don't quite follow exactly
Pretty sure the question speaks for itself..
Take this precondition
What vlad says it that it isn't handler for interactions
What should he do at that point
Now let's assume your command that says this precondition is needed handles message based commands AND slash commands
But it isn't handled for slash commands
Or messages
or contextMenus
Because maybe you forgot to make a handler
I mean aren't they handled by sapphire for messages?
message handlers will be optional
and well chatInputRuns are considered the new abstract run you must always provide
that makes more sense, I couldn't quite think the way through the question.
I think in these cases, if we error them, we would then have more runtime errors (unless they can be typed)
If we skip them, we could run into some conditions that would appear to be running, but don't, thus causing frustration for an end user
I would accept having them error due to having a much better understanding of why a precondition didn't run (If it errored, I didn't provide a valid handler / I used the wrong precondition- that should error, makes it much easier to debug and better (D)UX)
I'm leaning towards hard erroring
because it's safer for the user
I'd agree
I'd agree too
I can see skipping becoming a hassle for people in #old-sapphire-support i
i.e. "Why did my precondition not run for interactions but do for messages"
or permission escalations
yup
I don't see any valid use cases for skipping
it just seems like it would cause more headaches for everyone (devs, you)
But then SHOULD the chatInput ones be mandatory or not..
I want to make chatInputCommands the pushed way bc well, they're nice
good question
in doing so you would force people to think about using slash commands over message commands
win-win right?
which is what Discord (and ngl I) want
I can see that being annoying for some users but really, really important down the road
I mean the bitching will only bitch for TS users
:)
yeah
I can see this being slightly annoying at first, but nothing a find and replace command can solve
If no handler is defined. Dont run it. I think a same approach like the commands would be beneficial
Yeah BUT it can mean permissions escalation
Or accidentally forgetting to handle it
I mean. Skipping error'ing is just as bad
And since commands already have a seperate function to handle slashcommand functionality. It wouldnt be weird to have the same logic apply to other pieces imo
..well, yes