Add attachement colour option for Slack

This commit is contained in:
JonnyWong16 2016-10-17 22:11:24 -07:00 committed by JonnyWong16
commit 0c7db9c1ee

View file

@ -787,7 +787,7 @@ class DISCORD(Notifier):
title = pretty_metadata.get_title()
subtitle = pretty_metadata.get_subtitle()
# Build Slack post attachment
# Build Discord post attachment
attachment = {'title': title,
'description': subtitle,
'thumbnail': {'url': poster_url},
@ -2312,6 +2312,7 @@ class SLACK(Notifier):
'channel': '',
'username': '',
'icon_emoji': '',
'color': '',
'incl_pmslink': 0,
'incl_poster': 0,
'incl_subject': 1
@ -2327,7 +2328,7 @@ class SLACK(Notifier):
text = body.encode("utf-8")
data = {'text': text}
if self.config['channel']:
if self.config['channel'] and self.config['channel'].startswith('#'):
data['channel'] = self.config['channel']
if self.config['username']:
data['username'] = self.config['username']
@ -2355,6 +2356,9 @@ class SLACK(Notifier):
'thumb_url': poster_url
}
if self.config['color'] and self.config['color'].startswith('#'):
attachment['color'] = self.config['color']
fields = []
if poster_link:
attachment['title_link'] = poster_link
@ -2415,6 +2419,12 @@ class SLACK(Notifier):
'name': 'slack_icon_emoji',
'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',
'value': self.config['incl_poster'],
'name': 'slack_incl_poster',