From c51ee673e83e4ed2fe143f3ef8466575070e31ff Mon Sep 17 00:00:00 2001
From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
Date: Sat, 28 Jan 2023 13:29:12 -0800
Subject: [PATCH] Add support for Telegram group topics
* Closes #1980
---
plexpy/notifiers.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py
index fbd48c4b..75f810d8 100644
--- a/plexpy/notifiers.py
+++ b/plexpy/notifiers.py
@@ -3962,7 +3962,10 @@ class TELEGRAM(Notifier):
}
def agent_notify(self, subject='', body='', action='', **kwargs):
- data = {'chat_id': self.config['chat_id']}
+ chat_id, *message_thread_id = self.config['chat_id'].split('/')
+ data = {'chat_id': chat_id}
+ if message_thread_id:
+ data['message_thread_id'] = message_thread_id[0]
if self.config['incl_subject']:
text = subject + '\r\n' + body
@@ -4032,7 +4035,8 @@ class TELEGRAM(Notifier):
'description': 'Your Telegram Chat ID, Group ID, Channel ID or @channelusername. '
'Contact @myidbot'
- ' on Telegram to get an ID.',
+ ' on Telegram to get an ID. '
+ 'For a group topic, append /topicID to the group ID.',
'input_type': 'text'
},
{'label': 'Include Subject Line',