Skip to content

Commit 4db579e

Browse files
committed
Fix parsing reactions
thanks to KurimuzonAkuma/kurigram@e2002d1
1 parent a1c5ac0 commit 4db579e

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

pyrogram/types/messages_and_media/reaction.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ class Reaction(Object):
4141
Available for chosen reactions.
4242
4343
is_paid (``bool``, *optional*):
44-
True, if this is a paid reaction.
45-
44+
True, if reaction is paid.
4645
"""
4746

4847
def __init__(
@@ -67,7 +66,7 @@ def __init__(
6766
def _parse(
6867
client: "pyrogram.Client",
6968
reaction: "raw.base.Reaction"
70-
) -> Optional["Reaction"]:
69+
) -> "Reaction":
7170
if isinstance(reaction, raw.types.ReactionEmoji):
7271
return Reaction(
7372
client=client,
@@ -86,19 +85,13 @@ def _parse(
8685
is_paid=True
8786
)
8887

89-
return None
90-
9188
@staticmethod
9289
def _parse_count(
9390
client: "pyrogram.Client",
94-
reaction_count: Optional["raw.base.ReactionCount"]
95-
) -> Optional["Reaction"]:
96-
if not reaction_count:
97-
return None
98-
91+
reaction_count: "raw.base.ReactionCount"
92+
) -> "Reaction":
9993
reaction = Reaction._parse(client, reaction_count.reaction)
100-
if reaction:
101-
reaction.count = reaction_count.count if reaction_count else 0
102-
reaction.chosen_order = reaction_count.chosen_order
94+
reaction.count = reaction_count.count
95+
reaction.chosen_order = reaction_count.chosen_order
10396

10497
return reaction

0 commit comments

Comments
 (0)