telegram: Support for showing question and options of polls
patch a62e1a9973921a97198519dd5a74e1a4472b9364
Author: E. Bosch <presidev@AT@gmail.com>
Date: Wed Oct 11 00:35:28 CEST 2023
* telegram: Support for showing question and options of polls
diff -rN -u old-irgramd/README.md new-irgramd/README.md
--- old-irgramd/README.md 2024-05-18 06:56:04.312891584 +0200
+++ new-irgramd/README.md 2024-05-18 06:56:04.316891592 +0200
@@ -45,6 +45,7 @@
- Deletions (receive, do)
- Editions (receive, do)
- Reactions (receive)
+- Polls (receive, show)
- Dialogs management
- History
- Authentication and TLS for IRC
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-05-18 06:56:04.312891584 +0200
+++ new-irgramd/telegram.py 2024-05-18 06:56:04.316891592 +0200
@@ -758,7 +758,7 @@
media_type = 'poll'
caption = ''
to_download = False
- media_url_or_data = ''
+ media_url_or_data = self.handle_poll(message.media.poll)
elif message.venue:
media_type = 'venue'
@@ -776,6 +776,12 @@
return self.format_media(media_type, media_url_or_data, caption)
+ def handle_poll(self, poll):
+ text = poll.question
+ for ans in poll.answers:
+ text += '\n* ' + ans.text
+ return text
+
async def handle_webpage(self, webpage, message):
media_type = 'web'
logo = await self.download_telegram_media(message)