From da16796ec45a3ecb12f16a1855bca0813beb2571 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Sat, 19 Nov 2022 16:10:30 -0800 Subject: [PATCH 1/3] Add ability to send Telegram notifications silently. --- server/notification-providers/telegram.js | 1 + src/components/notifications/Telegram.vue | 9 +++++++++ src/languages/en.js | 2 ++ 3 files changed, 12 insertions(+) diff --git a/server/notification-providers/telegram.js b/server/notification-providers/telegram.js index 2b0576224..88923e665 100644 --- a/server/notification-providers/telegram.js +++ b/server/notification-providers/telegram.js @@ -13,6 +13,7 @@ class Telegram extends NotificationProvider { params: { chat_id: notification.telegramChatID, text: msg, + disable_notification: notification.telegramSendSilently, }, }); return okMsg; diff --git a/src/components/notifications/Telegram.vue b/src/components/notifications/Telegram.vue index 9daf31ac6..4eb014ff7 100644 --- a/src/components/notifications/Telegram.vue +++ b/src/components/notifications/Telegram.vue @@ -28,6 +28,15 @@ {{ telegramGetUpdatesURL("masked") }}

+ +
+ + +
+ +
+ {{ $t("telegramSendSilentlyDescription") }} +
diff --git a/src/languages/en.js b/src/languages/en.js index 86abb7912..492689e56 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -214,6 +214,8 @@ export default { "Chat ID": "Chat ID", supportTelegramChatID: "Support Direct Chat / Group / Channel's Chat ID", wayToGetTelegramChatID: "You can get your chat ID by sending a message to the bot and going to this URL to view the chat_id:", + "Send Silently": "Send Silently", + telegramSendSilentlyDescription: "Sends the message silently. Users will receive a notification with no sound.", "YOUR BOT TOKEN HERE": "YOUR BOT TOKEN HERE", chatIDNotFound: "Chat ID is not found; please send a message to this bot first", webhook: "Webhook", From 10228874fa41c7afaf4cca8ac72f3edc9ab9f5bd Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 24 Feb 2023 16:54:58 +0800 Subject: [PATCH 2/3] Merge manually --- server/notification-providers/telegram.js | 1 + src/components/notifications/Telegram.vue | 2 +- src/lang/en.json | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/notification-providers/telegram.js b/server/notification-providers/telegram.js index 7f46b3fc7..614e487ed 100644 --- a/server/notification-providers/telegram.js +++ b/server/notification-providers/telegram.js @@ -12,6 +12,7 @@ class Telegram extends NotificationProvider { let params = { chat_id: notification.telegramChatID, text: msg, + disable_notification: notification.telegramSendSilently ?? false, }; if (notification.telegramMessageThreadID) { params.message_thread_id = notification.telegramMessageThreadID; diff --git a/src/components/notifications/Telegram.vue b/src/components/notifications/Telegram.vue index 7816de740..a90ceafc1 100644 --- a/src/components/notifications/Telegram.vue +++ b/src/components/notifications/Telegram.vue @@ -35,7 +35,7 @@
- +
diff --git a/src/lang/en.json b/src/lang/en.json index c1249d31a..ef6cb688c 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -363,6 +363,8 @@ "Chat ID": "Chat ID", "telegramMessageThreadID": "(Optional) Message Thread ID", "telegramMessageThreadIDDescription": "Optional Unique identifier for the target message thread (topic) of the forum; for forum supergroups only", + "telegramSendSilently": "Send Silently", + "telegramSendSilentlyDescription": "Sends the message silently. Users will receive a notification with no sound.", "supportTelegramChatID": "Support Direct Chat / Group / Channel's Chat ID", "wayToGetTelegramChatID": "You can get your chat ID by sending a message to the bot and going to this URL to view the chat_id:", "YOUR BOT TOKEN HERE": "YOUR BOT TOKEN HERE", From 06278dc51fb89b3f7e323973fcc982c6b15cbd03 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 24 Feb 2023 17:03:40 +0800 Subject: [PATCH 3/3] Fix telegram silent issue --- src/components/notifications/Telegram.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/notifications/Telegram.vue b/src/components/notifications/Telegram.vue index a90ceafc1..52a63b8c7 100644 --- a/src/components/notifications/Telegram.vue +++ b/src/components/notifications/Telegram.vue @@ -34,7 +34,7 @@

{{ $t("telegramMessageThreadIDDescription") }}

- +