Skip to content

Commit

Permalink
fix: parse_tgpy_message no longer returns positive result for `TGPy e…
Browse files Browse the repository at this point in the history
…rror>` messages
  • Loading branch information
vanutp committed Sep 26, 2024
1 parent 1d3ba1a commit 818e47d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tgpy/api/parse_tgpy_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class MessageParseResult:

def parse_tgpy_message(message: Message) -> MessageParseResult:
e = get_title_entity(message)
if not e:
if (
not e
# Likely a `TGPy error>` message
or e.offset == 0
):
return MessageParseResult(False, None, None)
msg_text = Utf16CodepointsWrapper(message.raw_text)
code = msg_text[: e.offset].strip()
Expand Down

0 comments on commit 818e47d

Please sign in to comment.