Tawmy / Leyla.Bot

Privacy-focused Administration Bot for Discord
0 stars 0 forks source link

Missing error handling for user input in modals #16

Closed Tawmy closed 1 year ago

Tawmy commented 2 years ago

When using the /configure command and entering a value for an integer configuration option, the bot shows a modal with a text input (since that is the only kind of input it supports). This input allows the user to input any text, not just whole numbers like the integer field would require. When the user enters invalid text like "abc" and confirms the input, the modal loads for a few seconds, then shows a generic screenshot.

Screenshot 2022-11-01 at 15 19 20

It is not possible to restrict the input to just numbers, so there needs to be a validation when the user submits the input.

Todo:

If they do:

If they do not:

The latter would not be great considering the user would only see it once they've closed the modal.

Tawmy commented 2 years ago

So it seems there is no way to validate user input. Hopefully an ephemeral can give the user some feedback without being all too distracting. It's not a great solution but it is the only one I can think of.

Tawmy commented 1 year ago

"Solution" (more like a workaround) has been implemented. When the user inputs invalid integer or decimal values, the bot now shows a more specific error like below.

https://user-images.githubusercontent.com/22292560/202849243-93215f2c-ed5a-43e3-b7fb-cc8b5c232cac.mov

Tawmy commented 1 year ago

Checks for QA:

SafaiaArt commented 1 year ago

Yes to everything.

Note: For time based configurations (Raid Time, Lockdown Duration, etc), I think it would be good for the end user to know what the value translates to - whether it's seconds, minutes, hours etc.

Tawmy commented 1 year ago

Thanks for the QA!

Note: For time based configurations (Raid Time, Lockdown Duration, etc), I think it would be good for the end user to know what the value translates to - whether it's seconds, minutes, hours etc.

I agree, this will be added in #15.