This commit is contained in:
lightme16 2020-10-10 17:00:34 +03:00
parent 86113c0e32
commit c076fa621c

View file

@ -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(