Added "silent_message" option for Telegram Agent

Added a new checkbox in the notification telegram config in order to send new messages silently. In this way the telegram users will receive a notification with no sound.
This commit is contained in:
Gianfranco 2020-08-21 22:49:26 +02:00 committed by GitHub
parent 21dec5feb3
commit 81ee44b60f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of Tautulli. # This file is part of Tautulli.
# #
@ -3365,6 +3365,7 @@ class TELEGRAM(Notifier):
_DEFAULT_CONFIG = {'bot_token': '', _DEFAULT_CONFIG = {'bot_token': '',
'chat_id': '', 'chat_id': '',
'disable_web_preview': 0, 'disable_web_preview': 0,
'silent_message': 0,
'html_support': 1, 'html_support': 1,
'incl_subject': 1, 'incl_subject': 1,
'incl_poster': 0 'incl_poster': 0
@ -3410,6 +3411,9 @@ class TELEGRAM(Notifier):
data['text'] = (text[:4093] + (text[4093:] and '...')).encode('utf-8') data['text'] = (text[:4093] + (text[4093:] and '...')).encode('utf-8')
if self.config['silent_message']:
data['disable_notification'] = True
if self.config['disable_web_preview']: if self.config['disable_web_preview']:
data['disable_web_page_preview'] = True data['disable_web_page_preview'] = True
@ -3460,6 +3464,12 @@ class TELEGRAM(Notifier):
'name': 'telegram_disable_web_preview', 'name': 'telegram_disable_web_preview',
'description': 'Disables automatic link previews for links in the message', 'description': 'Disables automatic link previews for links in the message',
'input_type': 'checkbox' 'input_type': 'checkbox'
},
{'label': 'Enable Silent Messages',
'value': self.config['silent_message'],
'name': 'telegram_silent_message',
'description': 'Sends the message silently. Users will receive a notification with no sound.',
'input_type': 'checkbox'
} }
] ]