From 7a649d9dc2be4b95b18d2b3d05e768245c11602d Mon Sep 17 00:00:00 2001 From: Ben Loveridge Date: Thu, 21 Jul 2016 10:00:17 -0600 Subject: [PATCH] Support 'username' in the slack configuration --- config.pl-dist | 3 ++- config.pl-dist-win32 | 3 ++- plexWatch.pl | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.pl-dist b/config.pl-dist index 1a546dd..9b7e5a9 100644 --- a/config.pl-dist +++ b/config.pl-dist @@ -277,7 +277,8 @@ $notify = { 'push_paused' => 0, 'push_resumed' => 0, 'webhook_url' => 'https://hooks.slack.com/services/XXXXXXXXXXX/XXXXXXXXXX/XXXXXXXXXXXXXXXXX', #webhook url - 'channel' => '', # '@myuser', '#notifications', etc. '' uses default channel configured in the Slack webhook + 'channel' => '', # '@myuser', '#notifications', etc. ('' uses default channel configured in the Slack webhook) + 'username' => '', # username to send notifications as ('' uses default configured in Slack webhook) 'message' => '{user}', }, diff --git a/config.pl-dist-win32 b/config.pl-dist-win32 index a019f6d..f9e288c 100644 --- a/config.pl-dist-win32 +++ b/config.pl-dist-win32 @@ -241,7 +241,8 @@ $notify = { 'push_paused' => 0, 'push_resumed' => 0, 'webhook_url' => 'https://hooks.slack.com/services/XXXXXXXXXXX/XXXXXXXXXX/XXXXXXXXXXXXXXXXX', #webhook url - 'channel' => '', # '@myuser', '#notifications', etc. '' uses default channel configured in the Slack webhook + 'channel' => '', # '@myuser', '#notifications', etc. ('' uses default channel configured in the Slack webhook) + 'username' => '', # username to send notifications as ('' uses default configured in Slack webhook) 'message' => '{user}', }, diff --git a/plexWatch.pl b/plexWatch.pl index dd5e349..0f3776b 100755 --- a/plexWatch.pl +++ b/plexWatch.pl @@ -2369,7 +2369,7 @@ () my $channel = $sk{'channel'}; if ($options{'slack_channel'}) { $channel = $options{'slack_channel'}; } - my %post = ('text' => $sk{'message'}, 'channel' => $channel); + my %post = ('text' => $sk{'message'}, 'channel' => $channel, 'username' => $sk{'username'}); my $json = encode_json \%post; my $url = $sk{'webhook_url'};