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.
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
default to an empty string in Emoji#fromData #2172
default to an empty string in Emoji#fromData #2172
Changes from all commits
7879c5a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I want to suggest changing this from "" to "null". Discord can at times send a message object containing a reaction with a null name (occurs every now and then when the bot is adding multiple reactions to a message and more often when users are clicking the reactions while the bot is still applying new ones).
So normally an exception is thrown but the exception is pretty useless as there is nothing the JDA user can do to prevent it and there is no reason to not still build the message object with the proper reactions, even if one of the reactions will have the name "null". Your suggested fix would still throw an exception as the empty name would be checked in the fromCustom method.
Setting the name to "null" however removes the unnecessary exception and builds the message object more accurately (doesn't skip over the reaction with the null name, just builds the reaction with the name "null".
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.
nit: For consistency reason I would add that newline back or remove it too from the
MessageReactionClearEmojiHandler
and have the same variable name.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.
I don't think anything mentioned matters at all. in
MessageReactionClearEmojiHandler
, I think the variables passed intonew MessageReaction(...)
were just meant to be separated, same withMessageReactionHandler
and the check.