mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 09:42:57 -07:00
Update Slack agent
This commit is contained in:
parent
bfb6aee908
commit
b98faa0671
1 changed files with 10 additions and 10 deletions
|
@ -2323,11 +2323,11 @@ 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']:
|
||||||
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']
|
||||||
if self.config['icon_emoji'] != '':
|
if self.config['icon_emoji']:
|
||||||
if urlparse(self.config['icon_emoji']).scheme == '':
|
if urlparse(self.config['icon_emoji']).scheme == '':
|
||||||
data['icon_emoji'] = self.config['icon_emoji']
|
data['icon_emoji'] = self.config['icon_emoji']
|
||||||
else:
|
else:
|
||||||
|
@ -2364,12 +2364,12 @@ class SLACK(Notifier):
|
||||||
|
|
||||||
data['attachments'] = [attachment]
|
data['attachments'] = [attachment]
|
||||||
|
|
||||||
slackhost = urlparse(self.config['hook']).hostname
|
host = urlparse(self.config['hook']).hostname
|
||||||
slackpath = urlparse(self.config['hook']).path
|
path = urlparse(self.config['hook']).path
|
||||||
|
|
||||||
http_handler = HTTPSConnection(slackhost)
|
http_handler = HTTPSConnection(host)
|
||||||
http_handler.request("POST",
|
http_handler.request("POST",
|
||||||
slackpath,
|
path,
|
||||||
headers={'Content-type': "application/json"},
|
headers={'Content-type': "application/json"},
|
||||||
body=json.dumps(data))
|
body=json.dumps(data))
|
||||||
|
|
||||||
|
@ -2396,18 +2396,18 @@ class SLACK(Notifier):
|
||||||
{'label': 'Slack Channel',
|
{'label': 'Slack Channel',
|
||||||
'value': self.config['channel'],
|
'value': self.config['channel'],
|
||||||
'name': 'slack_channel',
|
'name': 'slack_channel',
|
||||||
'description': 'Your Slack channel name (begin with \'#\'). Leave blank for webhook integration default.',
|
'description': 'The Slack channel name (begins with \'#\') which will be used. Leave blank for webhook integration default.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Slack Username',
|
{'label': 'Slack Username',
|
||||||
'value': self.config['username'],
|
'value': self.config['username'],
|
||||||
'name': 'slack_username',
|
'name': 'slack_username',
|
||||||
'description': 'The Slack username which will be shown. Leave blank for webhook integration default.',
|
'description': 'The Slack username which will be used. Leave blank for webhook integration default.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Slack Icon',
|
{'label': 'Slack Icon',
|
||||||
'value': self.config['icon_emoji'],
|
'value': self.config['icon_emoji'],
|
||||||
'description': 'The icon you wish to show, use Slack emoji or image url. Leave blank for webhook integration default.',
|
'description': 'The Slack emoji or image url for the icon which will be used. Leave blank for webhook integration default.',
|
||||||
'name': 'slack_icon_emoji',
|
'name': 'slack_icon_emoji',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue