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

pull/2361/head
grokdesigns 7 years ago committed by Leonardo Galli
parent ffb098357d
commit 6a1b099117

@ -15,6 +15,8 @@ namespace NzbDrone.Core.Notifications.Slack.Payloads
[JsonProperty("icon_url")]
public string IconUrl { get; set; }
public string Channel { get; set; }
public List<Attachment> Attachments { get; set; }
}
}

@ -109,6 +109,7 @@ namespace NzbDrone.Core.Notifications.Slack
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 @@ namespace NzbDrone.Core.Notifications.Slack
}
}
if (channel.IsNotNullOrWhiteSpace())
{
payload.Channel = channel;
}
return payload;
}
}

@ -27,6 +27,9 @@ namespace NzbDrone.Core.Notifications.Slack
[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));

Loading…
Cancel
Save