mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Send Telegram notification separately if caption is longer than 200 characters (Closes Tautulli/Tautulli-Issues#20)
This commit is contained in:
parent
91c647f9ae
commit
a69008e179
1 changed files with 10 additions and 3 deletions
|
@ -3307,10 +3307,17 @@ class TELEGRAM(Notifier):
|
|||
if poster_content:
|
||||
poster_filename = 'poster_{}.jpg'.format(pretty_metadata.parameters['rating_key'])
|
||||
files = {'photo': (poster_filename, poster_content, 'image/jpeg')}
|
||||
data['caption'] = text
|
||||
|
||||
return self.make_request('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
||||
data=data, files=files)
|
||||
if len(text) > 200:
|
||||
data['disable_notification'] = True
|
||||
else:
|
||||
data['caption'] = text
|
||||
|
||||
r = self.make_request('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
||||
data=data, files=files)
|
||||
|
||||
if not data.pop('disable_notification', None):
|
||||
return r
|
||||
|
||||
data['text'] = text
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue