mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 09:22:03 +00:00
Simplify code
This commit is contained in:
parent
79677cb20f
commit
98173f64e1
1 changed files with 4 additions and 3 deletions
|
|
@ -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 or self.caption_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 or self.caption_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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue