1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Added: Customize Slack Channel (#2308) (Fixes #2298)

This commit is contained in:
grokdesigns 2017-12-04 01:07:42 -07:00 committed by Leonardo Galli
parent ffb098357d
commit 6a1b099117
3 changed files with 11 additions and 0 deletions

View File

@ -15,6 +15,8 @@ public class SlackPayload
[JsonProperty("icon_url")]
public string IconUrl { get; set; }
public string Channel { get; set; }
public List<Attachment> Attachments { get; set; }
}
}

View File

@ -109,6 +109,7 @@ public ValidationFailure TestMessage()
private SlackPayload CreatePayload(string message, List<Attachment> attachments = null)
{
var icon = Settings.Icon;
var channel = Settings.Channel;
var payload = new SlackPayload
{
@ -130,6 +131,11 @@ private SlackPayload CreatePayload(string message, List<Attachment> attachments
}
}
if (channel.IsNotNullOrWhiteSpace())
{
payload.Channel = channel;
}
return payload;
}
}

View File

@ -27,6 +27,9 @@ public class SlackSettings : IProviderConfig
[FieldDefinition(2, Label = "Icon", HelpText = "Change the icon that is used for messages from this integration (Emoji or URL)", Type = FieldType.Textbox, HelpLink = "http://www.emoji-cheat-sheet.com/")]
public string Icon { get; set; }
[FieldDefinition(3, Label = "Channel", HelpText = "Overrides the default channel for the incoming webhook (#other-channel)", Type = FieldType.Textbox)]
public string Channel { get; set; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));