mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Clean up Telegram send poster
This commit is contained in:
parent
a8e0502b41
commit
2a4b48d0fa
1 changed files with 8 additions and 8 deletions
|
@ -3406,21 +3406,21 @@ class TELEGRAM(Notifier):
|
|||
poster_filename = 'poster_{}.png'.format(pretty_metadata.parameters['rating_key'])
|
||||
files = {'photo': (poster_filename, poster_content, 'image/png')}
|
||||
|
||||
max_caption = len(text)
|
||||
|
||||
if max_caption > 1024:
|
||||
if len(text) > 1024:
|
||||
data['disable_notification'] = True
|
||||
self.make_request('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
||||
data=data, files=files)
|
||||
data.pop('disable_notification') #This prevents from alerting with 2 sounds Telegram when the Silent Message is OFF: one alert for the photo and the second one for the text
|
||||
else:
|
||||
data['caption'] = text.encode('utf-8')
|
||||
if self.config['silent_notification']:
|
||||
data['disable_notification'] = True
|
||||
|
||||
self.make_request('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
||||
data=data, files=files)
|
||||
|
||||
if 'caption' in data:
|
||||
return
|
||||
|
||||
data.pop('disable_notification', None)
|
||||
|
||||
data['text'] = (text[:4093] + (text[4093:] and '...')).encode('utf-8')
|
||||
|
||||
if self.config['disable_web_preview']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue