Send Telegram notification separately if caption is longer than 200 characters (Closes Tautulli/Tautulli-Issues#20)
This commit is contained in:
@@ -3307,10 +3307,17 @@ class TELEGRAM(Notifier):
|
|||||||
if poster_content:
|
if poster_content:
|
||||||
poster_filename = 'poster_{}.jpg'.format(pretty_metadata.parameters['rating_key'])
|
poster_filename = 'poster_{}.jpg'.format(pretty_metadata.parameters['rating_key'])
|
||||||
files = {'photo': (poster_filename, poster_content, 'image/jpeg')}
|
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']),
|
if len(text) > 200:
|
||||||
data=data, files=files)
|
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
|
data['text'] = text
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user