Merge pull request #2595 from tminei/telegram_test

Added a more telegram notifications options
This commit is contained in:
Louis Lam 2023-02-24 17:22:43 +08:00 committed by GitHub
commit 8e3dd4202f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions

View File

@ -755,7 +755,7 @@ class Monitor extends BeanModel {
await R.store(bean);
log.debug("monitor", `[${this.name}] prometheus.update`);
this.prometheus.update(bean, tlsInfo);
this.prometheus?.update(bean, tlsInfo);
previousBeat = bean;
@ -840,7 +840,7 @@ class Monitor extends BeanModel {
clearTimeout(this.heartbeatInterval);
this.isStop = true;
this.prometheus.remove();
this.prometheus?.remove();
}
/**

View File

@ -13,6 +13,7 @@ class Telegram extends NotificationProvider {
chat_id: notification.telegramChatID,
text: msg,
disable_notification: notification.telegramSendSilently ?? false,
protect_content: notification.telegramProtectContent ?? false,
};
if (notification.telegramMessageThreadID) {
params.message_thread_id = notification.telegramMessageThreadID;

View File

@ -42,6 +42,17 @@
{{ $t("telegramSendSilentlyDescription") }}
</div>
</div>
<div class="mb-3">
<div class="form-check form-switch">
<input v-model="$parent.notification.telegramProtectContent" class="form-check-input" type="checkbox">
<label class="form-check-label">{{ $t("telegramProtectContent") }}</label>
</div>
<div class="form-text">
{{ $t("telegramProtectContentDescription") }}
</div>
</div>
</template>
<script>

View File

@ -365,6 +365,8 @@
"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.",
"telegramProtectContent": "Protect Forwarding/Saving",
"telegramProtectContentDescription": "If enabled, the bot messages in Telegram will be protected from forwarding and saving.",
"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",