Commands: Allow bot to validate command arguments, and reflect on client #3510
Replies: 4 comments 5 replies
-
welp i have a very similar fr, this tbh |
Beta Was this translation helpful? Give feedback.
-
Better to give us access to Discord's client-side command validation to create our own custom argument types, so we can prevent the user from executing the command in the first place |
Beta Was this translation helpful? Give feedback.
-
I've been using just empheral messages and it works fine for most cases. You can use emoji, embeds and whatnot just fine. |
Beta Was this translation helpful? Give feedback.
-
I'd love this, too. Discord already has UX for "invalid argument", and I hate how inconsistent it gets as soon as I introduce additional validation on top of that. With the autocomplete system we already have an existing precedent for discord sending the content of an argument before the command is submitted, so clearly that's not an inherent consern. The optimal solution here would be for discord to allow me to register bot-side argument validation somehow, such that when the user tries to submit his command / finish typing an argument, I can look at the argument values and say "ahh, that one is invalid, here's a short description of why". I'd argue that most bots have lots of cases of additional argument validation being necessary, i.e. for commands taking a duration (needs to be parsed and then validated), Commands that require valid URLs, etc. I mainly think the UX currently suffers from this for two reasons:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Note: this is a continuation of #2452
The Problem
At the moment, it is really hard to do advanced validation of commands, and still imply that the command failed.
Although introducing a regex option would help, it still doesn't fully solve the problem.
The Scenario
I want to make a music bot, that plays music from youtube. Here is the structure for my command:
/music name:string
When the user runs the command, I want to be able to tell the user if the bot was able to find the music they requested. If not, I want the command to error out.
My Proposal
After the client runs the command, discord will ask the bot for an interaction response. If the response has type
8
(or another number lol who cares) it is considered a validation error. The response MUST include a short description of the error (will be displayed in red text like when an interaction fails), and can optionally include a long description of the error, which will be included under the short description and the icon.I also propose that error messages should be highlighted red, instead of purple (similar to how messages are highlighted orange when you are mentioned).
Beta Was this translation helpful? Give feedback.
All reactions