mirror of
https://github.com/paul-nameless/tg
synced 2025-02-16 10:38:23 +00:00
Display caption (when doc sent with text) (#97)
This commit is contained in:
parent
9c155811f5
commit
7ec5742a17
2 changed files with 9 additions and 0 deletions
|
@ -189,3 +189,10 @@ class MsgProxy:
|
|||
@property
|
||||
def forward(self) -> Optional[Dict[str, Any]]:
|
||||
return self.msg.get("forward_info")
|
||||
|
||||
@property
|
||||
def caption(self) -> Optional[str]:
|
||||
caption = self.msg["content"].get("caption")
|
||||
if not caption:
|
||||
return None
|
||||
return caption["text"]
|
||||
|
|
|
@ -344,6 +344,8 @@ class MsgView:
|
|||
) -> str:
|
||||
msg = self._parse_msg(msg_proxy)
|
||||
msg = msg.replace("\n", " ")
|
||||
if caption := msg_proxy.caption:
|
||||
msg += "\n" + caption.replace("\n", " ")
|
||||
msg += self._format_url(msg_proxy)
|
||||
if reply_to := msg_proxy.reply_msg_id:
|
||||
msg = self._format_reply_msg(
|
||||
|
|
Loading…
Add table
Reference in a new issue