From e563f7f75eaebf7116ee9aab3627d51d9dc8c8ef Mon Sep 17 00:00:00 2001 From: Dtaggart Date: Sun, 16 Aug 2020 13:42:14 -0400 Subject: [PATCH] New: Added silent notification option to telegram (cherry picked from commit 9e392977b9f66be37c1fd6938c0b051c362ddb42) --- src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs | 1 + src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs b/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs index fb8703bae..b21e8d609 100644 --- a/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs +++ b/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs @@ -37,6 +37,7 @@ public void SendNotification(string title, string message, TelegramSettings sett request.AddParameter("chat_id", settings.ChatId); request.AddParameter("parse_mode", "HTML"); request.AddParameter("text", text); + request.AddParameter("disable_notification", settings.SendSilently); client.ExecuteAndValidate(request); } diff --git a/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs b/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs index 58f04709e..051691c92 100644 --- a/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs +++ b/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs @@ -24,7 +24,8 @@ public class TelegramSettings : IProviderConfig [FieldDefinition(1, Label = "Chat ID", HelpLink = "http://stackoverflow.com/a/37396871/882971", HelpText = "You must start a conversation with the bot or add it to your group to receive messages")] public string ChatId { get; set; } - public bool IsValid => !string.IsNullOrWhiteSpace(ChatId) && !string.IsNullOrWhiteSpace(BotToken); + [FieldDefinition(2, Label = "Send Silently", Type = FieldType.Checkbox, HelpText = "Sends the message silently. Users will receive a notification with no sound")] + public bool SendSilently { get; set; } public NzbDroneValidationResult Validate() {