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-11-22 10:54:20.427896178 +0100
+++ new-irgramd/README.md 2024-11-22 10:54:20.427896178 +0100
@@ -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-11-22 10:54:20.427896178 +0100
+++ new-irgramd/telegram.py 2024-11-22 10:54:20.431896171 +0100
@@ -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)