mirror of
https://github.com/paul-nameless/tg
synced 2025-02-16 18:48:24 +00:00
prettify
This commit is contained in:
parent
86113c0e32
commit
c076fa621c
1 changed files with 15 additions and 13 deletions
28
tg/views.py
28
tg/views.py
|
@ -387,19 +387,21 @@ class MsgView:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _format_reply_markup(msg_proxy: MsgProxy) -> str:
|
def _format_reply_markup(msg_proxy: MsgProxy) -> str:
|
||||||
msg = ""
|
msg = ""
|
||||||
if reply_markup := msg_proxy.reply_markup:
|
reply_markup = msg_proxy.reply_markup
|
||||||
for row in reply_markup.get("rows", []):
|
if not reply_markup:
|
||||||
msg += "\n"
|
return msg
|
||||||
for item in row:
|
for row in reply_markup.get("rows", []):
|
||||||
text = item.get("text")
|
msg += "\n"
|
||||||
if not text:
|
for item in row:
|
||||||
continue
|
text = item.get("text")
|
||||||
_type = item.get("type", {})
|
if not text:
|
||||||
if _type.get("@type") == "inlineKeyboardButtonTypeUrl":
|
continue
|
||||||
if url := _type.get("url"):
|
_type = item.get("type", {})
|
||||||
text = f"{text} ({url})"
|
if _type.get("@type") == "inlineKeyboardButtonTypeUrl":
|
||||||
msg += f"| {text} "
|
if url := _type.get("url"):
|
||||||
msg += "|"
|
text = f"{text} ({url})"
|
||||||
|
msg += f"| {text} "
|
||||||
|
msg += "|"
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def _collect_msgs_to_draw(
|
def _collect_msgs_to_draw(
|
||||||
|
|
Loading…
Add table
Reference in a new issue