Convenience methods for TextInputModelSubmission.Value conversions#2393
Open
ecrocombe wants to merge 6 commits intoDSharpPlus:masterfrom
Open
Convenience methods for TextInputModelSubmission.Value conversions#2393ecrocombe wants to merge 6 commits intoDSharpPlus:masterfrom
ecrocombe wants to merge 6 commits intoDSharpPlus:masterfrom
Conversation
akiraveliara
requested changes
Nov 16, 2025
Member
akiraveliara
left a comment
There was a problem hiding this comment.
without commenting on the general desire for the change (cc @Plerx2493 ), these should be instance methods and we'd not want to use regions if not absolutely necessary
also, left a comment
Comment on lines
+148
to
+155
| foreach (string i in submission.Values) | ||
| { | ||
| if (i.TryGetValueAs<T>(out T? value)) | ||
| { | ||
| yield return value; | ||
| } | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
this should have an error case, probably an exception
…ption on SelectMenuModalSubmission.GetValuesAs, to align with TextInputModalSubmission.GetValueAs on parsing errors.
akiraveliara
requested changes
Dec 19, 2025
|
|
||
| namespace DSharpPlus.Extensions; | ||
|
|
||
| internal static class StringExtentions |
Member
There was a problem hiding this comment.
upon thinking about this further, i think we absolutely should not extend string even internally, since it'll pollute the symbol space for every string in the entire project. use a static helper method instead, please
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proposed convenience methods for parsing string Value of
TextInputModelSubmissiontoT.Details
Some convenience methods for parsing string Value.
Notes
Maybe these should be placed in extensions? will leave that up to your discretion.