diff --git a/src/NzbDrone.Core/Notifications/Discord/Discord.cs b/src/NzbDrone.Core/Notifications/Discord/Discord.cs index 9eb41e98956..0e442d8ecbb 100644 --- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs +++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs @@ -65,6 +65,11 @@ public override void OnGrab(GrabMessage message) discordField.Name = "Host"; discordField.Value = message.Host ?? string.Empty; break; + case DiscordGrabFieldType.Size: + discordField.Name = "Size"; + discordField.Value = BytesToString(message.Release.Size.GetValueOrDefault(0)); + discordField.Inline = true; + break; } if (discordField.Name.IsNotNullOrWhiteSpace() && discordField.Value.IsNotNullOrWhiteSpace()) diff --git a/src/NzbDrone.Core/Notifications/Discord/DiscordFieldType.cs b/src/NzbDrone.Core/Notifications/Discord/DiscordFieldType.cs index bfce315446e..b84f633e2a2 100644 --- a/src/NzbDrone.Core/Notifications/Discord/DiscordFieldType.cs +++ b/src/NzbDrone.Core/Notifications/Discord/DiscordFieldType.cs @@ -7,6 +7,7 @@ public enum DiscordGrabFieldType DownloadClient, GrabTrigger, Source, - Host + Host, + Size } } diff --git a/src/NzbDrone.Core/Notifications/Discord/DiscordSettings.cs b/src/NzbDrone.Core/Notifications/Discord/DiscordSettings.cs index 45aedf1892b..106c4b95af1 100644 --- a/src/NzbDrone.Core/Notifications/Discord/DiscordSettings.cs +++ b/src/NzbDrone.Core/Notifications/Discord/DiscordSettings.cs @@ -19,10 +19,19 @@ public class DiscordSettings : IProviderConfig public DiscordSettings() { //Set Default Fields - GrabFields = new List { 0, 1, 2, 3, 5, 6, 7, 8, 9 }; + GrabFields = new List + { + (int)DiscordGrabFieldType.Release, + (int)DiscordGrabFieldType.Indexer, + (int)DiscordGrabFieldType.DownloadClient, + (int)DiscordGrabFieldType.GrabTrigger, + (int)DiscordGrabFieldType.Source, + (int)DiscordGrabFieldType.Host, + (int)DiscordGrabFieldType.Size + }; } - private static readonly DiscordSettingsValidator Validator = new DiscordSettingsValidator(); + private static readonly DiscordSettingsValidator Validator = new (); [FieldDefinition(0, Label = "Webhook URL", HelpText = "Discord channel webhook url")] public string WebHookUrl { get; set; } @@ -36,7 +45,7 @@ public DiscordSettings() [FieldDefinition(3, Label = "Host", Advanced = true, HelpText = "Override the Host that shows for this notification, Blank is machine name", Type = FieldType.Textbox)] public string Author { get; set; } - [FieldDefinition(4, Label = "On Grab Fields", Advanced = true, SelectOptions = typeof(DiscordGrabFieldType), HelpText = "Change the fields that are passed in for this 'on grab' notification", Type = FieldType.TagSelect)] + [FieldDefinition(4, Label = "On Grab Fields", Advanced = true, SelectOptions = typeof(DiscordGrabFieldType), HelpText = "Change the fields that are passed in for this 'on grab' notification", Type = FieldType.Select)] public IEnumerable GrabFields { get; set; } public NzbDroneValidationResult Validate()