mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Add option to disable web page preview for Telegram
This commit is contained in:
parent
5d84ec3be2
commit
9c9ef22730
2 changed files with 13 additions and 1 deletions
|
@ -510,6 +510,7 @@ _CONFIG_DEFINITIONS = {
|
||||||
'TELEGRAM_BOT_TOKEN': (str, 'Telegram', ''),
|
'TELEGRAM_BOT_TOKEN': (str, 'Telegram', ''),
|
||||||
'TELEGRAM_ENABLED': (int, 'Telegram', 0),
|
'TELEGRAM_ENABLED': (int, 'Telegram', 0),
|
||||||
'TELEGRAM_CHAT_ID': (str, 'Telegram', ''),
|
'TELEGRAM_CHAT_ID': (str, 'Telegram', ''),
|
||||||
|
'TELEGRAM_DISABLE_WEB_PREVIEW': (int, 'Telegram', 0),
|
||||||
'TELEGRAM_HTML_SUPPORT': (int, 'Telegram', 1),
|
'TELEGRAM_HTML_SUPPORT': (int, 'Telegram', 1),
|
||||||
'TELEGRAM_INCL_POSTER': (int, 'Telegram', 0),
|
'TELEGRAM_INCL_POSTER': (int, 'Telegram', 0),
|
||||||
'TELEGRAM_INCL_SUBJECT': (int, 'Telegram', 1),
|
'TELEGRAM_INCL_SUBJECT': (int, 'Telegram', 1),
|
||||||
|
|
|
@ -1839,6 +1839,7 @@ class TELEGRAM(object):
|
||||||
self.enabled = plexpy.CONFIG.TELEGRAM_ENABLED
|
self.enabled = plexpy.CONFIG.TELEGRAM_ENABLED
|
||||||
self.bot_token = plexpy.CONFIG.TELEGRAM_BOT_TOKEN
|
self.bot_token = plexpy.CONFIG.TELEGRAM_BOT_TOKEN
|
||||||
self.chat_id = plexpy.CONFIG.TELEGRAM_CHAT_ID
|
self.chat_id = plexpy.CONFIG.TELEGRAM_CHAT_ID
|
||||||
|
self.disable_web_preview = plexpy.CONFIG.TELEGRAM_DISABLE_WEB_PREVIEW
|
||||||
self.html_support = plexpy.CONFIG.TELEGRAM_HTML_SUPPORT
|
self.html_support = plexpy.CONFIG.TELEGRAM_HTML_SUPPORT
|
||||||
self.incl_poster = plexpy.CONFIG.TELEGRAM_INCL_POSTER
|
self.incl_poster = plexpy.CONFIG.TELEGRAM_INCL_POSTER
|
||||||
self.incl_subject = plexpy.CONFIG.TELEGRAM_INCL_SUBJECT
|
self.incl_subject = plexpy.CONFIG.TELEGRAM_INCL_SUBJECT
|
||||||
|
@ -1880,9 +1881,13 @@ class TELEGRAM(object):
|
||||||
logger.warn(u"PlexPy Notifiers :: Telegram poster failed.")
|
logger.warn(u"PlexPy Notifiers :: Telegram poster failed.")
|
||||||
|
|
||||||
data['text'] = text
|
data['text'] = text
|
||||||
|
|
||||||
if self.html_support:
|
if self.html_support:
|
||||||
data['parse_mode'] = 'HTML'
|
data['parse_mode'] = 'HTML'
|
||||||
|
|
||||||
|
if self.disable_web_preview:
|
||||||
|
data['disable_web_page_preview'] = True
|
||||||
|
|
||||||
http_handler = HTTPSConnection("api.telegram.org")
|
http_handler = HTTPSConnection("api.telegram.org")
|
||||||
http_handler.request('POST',
|
http_handler.request('POST',
|
||||||
'/bot%s/%s' % (self.bot_token, 'sendMessage'),
|
'/bot%s/%s' % (self.bot_token, 'sendMessage'),
|
||||||
|
@ -1945,7 +1950,13 @@ class TELEGRAM(object):
|
||||||
{'label': 'Enable HTML Support',
|
{'label': 'Enable HTML Support',
|
||||||
'value': self.html_support,
|
'value': self.html_support,
|
||||||
'name': 'telegram_html_support',
|
'name': 'telegram_html_support',
|
||||||
'description': 'Style your messages using these HTML tags: b, i, a[href], code, pre',
|
'description': 'Style your messages using these HTML tags: b, i, a[href], code, pre.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Disable Web Page Previews',
|
||||||
|
'value': self.disable_web_preview,
|
||||||
|
'name': 'telegram_disable_web_preview',
|
||||||
|
'description': 'Disables automatic link previews for links in the message',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue