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?
UndiedGFX•953d ago
Maybe skip them till you add preconditions for slashies?
vladdy•953d ago
Not the question at hand
24•953d ago
can you define an example?
vladdy•953d ago
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 /
24•953d ago
skip
means you could define everything in 1 array
buuut
vladdy•953d ago
but should it be skipped
Or should it throw an error
UndiedGFX•953d ago
Maybe throw an ephermal message?
As error
vladdy•953d ago
Not doing user responses for them
UndiedGFX•953d ago
Ah
vladdy•953d ago
We don't even have an in-chat error message by default
24•953d ago
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
UndiedGFX•953d ago
I mean we do handle it
On commandDenied
vladdy•953d ago
There is no listener for commandDenied included by default
UndiedGFX•953d ago
So just like how normal preconditions work would be OK ish
Erhm
vladdy•953d ago
I'm also not talking about the preconditions array
But running the preconditions specified
UndiedGFX•953d ago
Maybe throwing an error could be helpful
24•953d ago
can you define an example? I still don't quite follow exactly
vladdy•953d ago
Pretty sure the question speaks for itself..
Take this precondition
UndiedGFX•953d ago
What vlad says it that it isn't handler for interactions
What should he do at that point
vladdy•953d ago
Now let's assume your command that says this precondition is needed handles message based commands AND slash commands
UndiedGFX•953d ago
But it isn't handled for slash commands
vladdy•953d ago
Or messages
or contextMenus
UndiedGFX•953d ago
Because maybe you forgot to make a handler
I mean aren't they handled by sapphire for messages?
vladdy•953d ago
message handlers will be optional
UndiedGFX•953d ago
vladdy•953d ago
and well chatInputRuns are considered the new abstract run you must always provide
24•953d ago
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)
vladdy•953d ago
I'm leaning towards hard erroring
because it's safer for the user
24•953d ago
I'd agree
UndiedGFX•953d ago
I'd agree too
24•953d ago
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"
vladdy•953d ago
or permission escalations
24•953d ago
yup
I don't see any valid use cases for skipping
it just seems like it would cause more headaches for everyone (devs, you)
vladdy•953d ago
But then SHOULD the chatInput ones be mandatory or not..
I want to make chatInputCommands the pushed way bc well, they're nice
24•953d ago
good question
in doing so you would force people to think about using slash commands over message commands
win-win right?
vladdy•953d ago
which is what Discord (and ngl I) want
24•953d ago
I can see that being annoying for some users but really, really important down the road
vladdy•953d ago
I mean the bitching will only bitch for TS users
24•953d ago
:)
yeah
I can see this being slightly annoying at first, but nothing a find and replace command can solve
𝖄𝖚𝖌𝖊𝖓•953d ago
If no handler is defined. Dont run it. I think a same approach like the commands would be beneficial
vladdy•953d ago
Yeah BUT it can mean permissions escalation
Or accidentally forgetting to handle it
𝖄𝖚𝖌𝖊𝖓•953d ago
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
vladdy•953d ago
..well, yes
Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.2KMembers
View on DiscordWant results from more Discord servers?
More PostsContext Menus vs Application Commands - separate or not?**Question time** ❓
Context menus.. they exist. They're like used once a blue century. How should Interaction Handlers after usageWant to give interaction handlers a shot **now**?
Well, you can! Just run the command below and givInteraction Handlers!!Hello peeps!
I know, I know, allllll of you (myself included) are just basically begging me for appInitial Commit ThoughtsI've pushed the initial commit for interaction handlers: heavily wip, totally untested and raw (justThe statefulness or statelessness of Interactions1. Most likely, but it would be a nice addition if I was able to have non-state "callbacks" as mentiInteraction handlers in the command instead of globallyHonestly. I would much rather add interactions from my command and from there tell to continue in (fReply sess 2**1.** Yes. This also follows the design pattern that we more-or-less employ already for Sapphire. Wdont feel like creating a review on GitHub...PR is up: https://github.com/sapphiredev/utilities/pull/152
CC @kyra 🩵🩷🤍🩷🩵 @vladdy