mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -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,11 +3307,18 @@ 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')}
|
||||||
|
|
||||||
|
if len(text) > 200:
|
||||||
|
data['disable_notification'] = True
|
||||||
|
else:
|
||||||
data['caption'] = text
|
data['caption'] = text
|
||||||
|
|
||||||
return self.make_request('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
r = self.make_request('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
||||||
data=data, files=files)
|
data=data, files=files)
|
||||||
|
|
||||||
|
if not data.pop('disable_notification', None):
|
||||||
|
return r
|
||||||
|
|
||||||
data['text'] = text
|
data['text'] = text
|
||||||
|
|
||||||
if self.config['disable_web_preview']:
|
if self.config['disable_web_preview']:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue