mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Simplify code
This commit is contained in:
parent
79677cb20f
commit
98173f64e1
1 changed files with 4 additions and 3 deletions
|
|
@ -193,7 +193,8 @@ class Message(base.TelegramObject):
|
||||||
|
|
||||||
quote_fn = md.quote_html if as_html else md.escape_md
|
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)
|
return quote_fn(text)
|
||||||
|
|
||||||
if not sys.maxunicode == 0xffff:
|
if not sys.maxunicode == 0xffff:
|
||||||
|
|
@ -202,7 +203,7 @@ class Message(base.TelegramObject):
|
||||||
result = ''
|
result = ''
|
||||||
offset = 0
|
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)
|
entity_text = entity.parse(text, as_html=as_html)
|
||||||
|
|
||||||
if sys.maxunicode == 0xffff:
|
if sys.maxunicode == 0xffff:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue