-
Notifications
You must be signed in to change notification settings - Fork 8
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
Handle long help post titles gracefully #163
Merged
Merged
Conversation
This file contains 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
trag1c
reviewed
Feb 24, 2025
trag1c
requested changes
Feb 25, 2025
b8b79cd
to
29ab437
Compare
Before this change, if the new title was longer than 100 characters, an exception would be raised.
If there are random square brackets lying around that also get stripped by this, there are probably bigger issues to deal with. Co-authored-by: trag1c <[email protected]>
As well as needless duplication of identical format strings.
This both removes the large comment as the format is in the pattern itself, and makes the code much more readable. I had completely forgotten that Python had pattern matching, oops! Thanks trag1c. Co-authored-by: trag1c <[email protected]>
c35f8eb
to
91fe8e9
Compare
A quick summary: - Remove superfluous pattern matching and just directly access the field. - Avoid blind attempts to make the error message grammatically correct, and instead simply rethrow the error if we didn't expect it, and hard-code an error message for the errors we expected.
This way it stands out from the original additional reply.
91fe8e9
to
55ac713
Compare
trag1c
reviewed
Feb 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, LGTM other than that.
Co-authored-by: trag1c <[email protected]>
543b4c5
to
f10bb51
Compare
trag1c
approved these changes
Feb 25, 2025
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.
Continuation of #151, thank you GitHub.
Before this change, if the new title was longer than 100 characters, an exception would be raised.
This is very hacky and probably the worst code I've ever PR'd. Perhaps "Unable to change the post title." should be returned without all that effort to show the error from the Discord API; I can change the PR to do so if requested, though I would prefer to have the nicer message so the user of the command actually knows what happened.