From f163e8588078cd8ca83e48271516f86982992e32 Mon Sep 17 00:00:00 2001 From: lightme16 Date: Sat, 10 Oct 2020 17:06:10 +0300 Subject: [PATCH] add tg msg method --- tg/msg.py | 5 +++++ tg/views.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tg/msg.py b/tg/msg.py index c9ef786..deb5288 100644 --- a/tg/msg.py +++ b/tg/msg.py @@ -207,6 +207,11 @@ class MsgProxy: def reply_markup(self) -> Optional[Dict[str, Any]]: return self.msg.get("reply_markup") + @property + def reply_markup_rows(self) -> List[List[Dict[str, Any]]]: + assert self.reply_markup + return self.reply_markup.get("rows", []) + @property def chat_id(self) -> int: return self.msg["chat_id"] diff --git a/tg/views.py b/tg/views.py index 94e0810..542f1e6 100644 --- a/tg/views.py +++ b/tg/views.py @@ -390,7 +390,7 @@ class MsgView: reply_markup = msg_proxy.reply_markup if not reply_markup: return msg - for row in reply_markup.get("rows", []): + for row in msg_proxy.reply_markup_rows: msg += "\n" for item in row: text = item.get("text")