mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-27 20:37:54 +00:00
Add html attribute to message.text
This commit is contained in:
parent
c0f61fd40c
commit
34d7749dbf
@ -36,6 +36,7 @@ class Str(str):
|
|||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
str.__init__(value)
|
str.__init__(value)
|
||||||
self._markdown = None
|
self._markdown = None
|
||||||
|
self._html = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def markdown(self):
|
def markdown(self):
|
||||||
@ -45,6 +46,14 @@ class Str(str):
|
|||||||
def markdown(self, value):
|
def markdown(self, value):
|
||||||
self._markdown = value
|
self._markdown = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def html(self):
|
||||||
|
return self._html
|
||||||
|
|
||||||
|
@html.setter
|
||||||
|
def html(self, value):
|
||||||
|
self._html = value
|
||||||
|
|
||||||
|
|
||||||
ENTITIES = {
|
ENTITIES = {
|
||||||
types.MessageEntityMention.ID: "mention",
|
types.MessageEntityMention.ID: "mention",
|
||||||
@ -572,10 +581,16 @@ def parse_messages(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if m.text:
|
if m.text:
|
||||||
m.text.markdown = client.markdown.unparse(m.text, m.entities or [])
|
args = (m.text, m.entities or [])
|
||||||
|
|
||||||
|
m.text.markdown = client.markdown.unparse(*args)
|
||||||
|
m.text.html = client.html.unparse(*args)
|
||||||
|
|
||||||
if m.caption:
|
if m.caption:
|
||||||
m.caption.markdown = client.markdown.unparse(m.caption, m.caption_entities or [])
|
args = (m.caption, m.caption_entities or [])
|
||||||
|
|
||||||
|
m.caption.markdown = client.markdown.unparse(*args)
|
||||||
|
m.caption.html = client.html.unparse(*args)
|
||||||
|
|
||||||
if message.reply_to_msg_id and replies:
|
if message.reply_to_msg_id and replies:
|
||||||
while True:
|
while True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user