mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Add attachement colour option for Slack
This commit is contained in:
parent
7df455309e
commit
0c7db9c1ee
1 changed files with 12 additions and 2 deletions
|
@ -787,7 +787,7 @@ class DISCORD(Notifier):
|
||||||
title = pretty_metadata.get_title()
|
title = pretty_metadata.get_title()
|
||||||
subtitle = pretty_metadata.get_subtitle()
|
subtitle = pretty_metadata.get_subtitle()
|
||||||
|
|
||||||
# Build Slack post attachment
|
# Build Discord post attachment
|
||||||
attachment = {'title': title,
|
attachment = {'title': title,
|
||||||
'description': subtitle,
|
'description': subtitle,
|
||||||
'thumbnail': {'url': poster_url},
|
'thumbnail': {'url': poster_url},
|
||||||
|
@ -2312,6 +2312,7 @@ class SLACK(Notifier):
|
||||||
'channel': '',
|
'channel': '',
|
||||||
'username': '',
|
'username': '',
|
||||||
'icon_emoji': '',
|
'icon_emoji': '',
|
||||||
|
'color': '',
|
||||||
'incl_pmslink': 0,
|
'incl_pmslink': 0,
|
||||||
'incl_poster': 0,
|
'incl_poster': 0,
|
||||||
'incl_subject': 1
|
'incl_subject': 1
|
||||||
|
@ -2327,7 +2328,7 @@ class SLACK(Notifier):
|
||||||
text = body.encode("utf-8")
|
text = body.encode("utf-8")
|
||||||
|
|
||||||
data = {'text': text}
|
data = {'text': text}
|
||||||
if self.config['channel']:
|
if self.config['channel'] and self.config['channel'].startswith('#'):
|
||||||
data['channel'] = self.config['channel']
|
data['channel'] = self.config['channel']
|
||||||
if self.config['username']:
|
if self.config['username']:
|
||||||
data['username'] = self.config['username']
|
data['username'] = self.config['username']
|
||||||
|
@ -2355,6 +2356,9 @@ class SLACK(Notifier):
|
||||||
'thumb_url': poster_url
|
'thumb_url': poster_url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.config['color'] and self.config['color'].startswith('#'):
|
||||||
|
attachment['color'] = self.config['color']
|
||||||
|
|
||||||
fields = []
|
fields = []
|
||||||
if poster_link:
|
if poster_link:
|
||||||
attachment['title_link'] = poster_link
|
attachment['title_link'] = poster_link
|
||||||
|
@ -2415,6 +2419,12 @@ class SLACK(Notifier):
|
||||||
'name': 'slack_icon_emoji',
|
'name': 'slack_icon_emoji',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
|
{'label': 'Slack Color',
|
||||||
|
'value': self.config['color'],
|
||||||
|
'description': 'The hex value color (begins with \'#\') for the border along the left side of the message attachment.',
|
||||||
|
'name': 'slack_color',
|
||||||
|
'input_type': 'text'
|
||||||
|
},
|
||||||
{'label': 'Include Poster Image',
|
{'label': 'Include Poster Image',
|
||||||
'value': self.config['incl_poster'],
|
'value': self.config['incl_poster'],
|
||||||
'name': 'slack_incl_poster',
|
'name': 'slack_incl_poster',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue