Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standardize customid formats + parsing #70

Open
rsek opened this issue Jan 25, 2022 · 0 comments
Open

standardize customid formats + parsing #70

rsek opened this issue Jan 25, 2022 · 0 comments

Comments

@rsek
Copy link
Collaborator

rsek commented Jan 25, 2022

following a tangent in XenotropicDev/TheOracle2#18

i think it'd be a good to move customids from e.g. action-name-param1-param2 to action-name:param1,param2 so that the delimiting characters are well-distinguished. but if we're doing that, i reckon it bears thinking about the format and considering what else we might want to standardize, so we don't have to change everything down the road later.

  • for me, the ideal handling of component interactions wildcards would be similar to slash commands: with the correct attributes, conversion to/from from Enums to strings would be automatic. there could be some customid-specific additions as well, e.g. int.TryParse() would be done when a given wildcard is supposed to be an integer, and so on.
    • it'd be very cool to use the same methods for both slash commands and components that do the same thing, but this may be more trouble than it's worth given the differences between their respective contexts
    • this strikes me as the sort of thing that other Discord.net users would find useful, too - might be a good candidate for contributing to the labs repo?
  • extending customid functionality to SelectMenu Values
    • if it's a MaxSelections==1 menu, automatically pass Interaction.Data.Values.First() as a method parameter
    • for MaxSelections>1, could be handled with spread/rest params in the method?
    • some means of using wildcards w/ selection menu values themselves, alongside the customId from the parent menu
    • could this be handled with an extension method or class?
  • how to handle character escapes?
    • have a policy of "none, ever": avoid any commas or colons in parameters, accept no arbitrary user text, etc
      • may be less draconian than it sounds, given that strings can be extracted from e.g. Component.Label and Component.Description
    • use a character to delimit strings to be taken verbatim, e.g. backticks
    • use a character to escape specific characters, e.g. backslash
  • how will modals and text inputs fit in to all of this? i imagine most of them would be used for changing things like the Title and Description fields of embeds... but is there other ways we might use them?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant