From e5a2afee37ebf44bd851194da1c39edbc6b914a2 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 16 Feb 2019 19:55:27 +0200 Subject: [PATCH] Improve Matrix representation of Telegram polls --- mautrix_telegram/portal.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py index 0a0336bd..50d51c52 100644 --- a/mautrix_telegram/portal.py +++ b/mautrix_telegram/portal.py @@ -1506,19 +1506,21 @@ class Portal: relates_to: dict) -> dict: poll = evt.media.poll # type: Poll poll_id = self._encode_msgid(source, evt) - text = (f"Poll: {poll.question}\n\n" - + "\n".join(f"* {answer.text}" for answer in poll.answers) - + "\n" - + f"Poll ID: {poll_id}") def enc(answer: PollAnswer) -> str: return base64.b64encode(answer.option).decode("utf-8").rstrip("=") - html = (f"Poll: {poll.question}
\n\n" + f"Vote with !tg vote <poll ID> <choice ID>") await intent.set_typing(self.mxid, is_typing=False) return await intent.send_text(self.mxid, text, html=html, relates_to=relates_to, msgtype="m.text", timestamp=evt.date,