Merge pull request #102 from Kylmakalle/patch-2

Fixed entities parsing for captions
This commit is contained in:
Alex Root Junior 2019-02-22 17:51:48 +02:00 committed by GitHub
commit dd899c9ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,8 +192,9 @@ class Message(base.TelegramObject):
raise TypeError("This message doesn't have any text.")
quote_fn = md.quote_html if as_html else md.escape_md
if not self.entities:
entities = self.entities or self.caption_entities
if not entities:
return quote_fn(text)
if not sys.maxunicode == 0xffff:
@ -202,7 +203,7 @@ class Message(base.TelegramObject):
result = ''
offset = 0
for entity in sorted(self.entities, key=lambda item: item.offset):
for entity in sorted(entities, key=lambda item: item.offset):
entity_text = entity.parse(text, as_html=as_html)
if sys.maxunicode == 0xffff: