-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add is_super() method to Reaction #10011
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -114,6 +114,13 @@ def is_custom_emoji(self) -> bool: | |||||
""":class:`bool`: If this is a custom emoji.""" | ||||||
return not isinstance(self.emoji, str) | ||||||
|
||||||
def is_super(self) -> bool: | ||||||
""":class:`bool`: Whether this reaction is a super reaction. | ||||||
|
||||||
.. versionadded:: 2.5 | ||||||
""" | ||||||
return self.normal_count == 0 and self.burst_count > 0 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious. EDIT: Just tested and you cannot add a super reaction and a normal reaction of the same emoji. Surely this check should just be like so, then:-
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can, you just can't do it yourself. E.g. I can add emoji x, another person can add emoji x as a super reaction. The reactions from the API should still only be 1 object, with a count of 2 (one burst and one normal), even though they appear separately on the clients. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Further testing reveals that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, that’s annoying. The original point of this was just to determine whether the reaction was a super one, but I didn’t realize that other users could add a normal version of the same emoji. We could still make this work by removing the normal_count check, but that would be misleading. I guess I think it might be best to scrap this and look into better solutions like separating the classes or something at the API level. |
||||||
|
||||||
def __eq__(self, other: object) -> bool: | ||||||
return isinstance(other, self.__class__) and other.emoji == self.emoji | ||||||
|
||||||
|
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.
What would be more acceptable is the following:-
Meaning the end user can check if the
Reaction
has a super reaction. However one could argue we'd then also need ahas_normal
which doesn't read very well to me.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.
This feels more weird meaning and readability wise. The way it is makes more sense than
Reaction.has_super
imo. A reaction don't have a super reaction within.