mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Added a more telegram options
such as thread id, silent notifications and forward protect
This commit is contained in:
parent
d9f12a6376
commit
b91fe9d96d
3 changed files with 53 additions and 4 deletions
|
@ -9,11 +9,20 @@ class Telegram extends NotificationProvider {
|
||||||
let okMsg = "Sent Successfully.";
|
let okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, {
|
const paramsObj =
|
||||||
params: {
|
{
|
||||||
chat_id: notification.telegramChatID,
|
chat_id: notification.telegramChatID,
|
||||||
text: msg,
|
text: msg,
|
||||||
},
|
disable_notification: notification.telegramSilentNotification ?? false,
|
||||||
|
protect_content: notification.telegramProtectContent ?? false,
|
||||||
|
|
||||||
|
};
|
||||||
|
// if telegramChatThread specified, then add it to paramsObj
|
||||||
|
if (notification.telegramChatThread && notification.telegramChatThread.length > 0) {
|
||||||
|
paramsObj.message_thread_id = notification.telegramChatThread;
|
||||||
|
}
|
||||||
|
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, {
|
||||||
|
params: paramsObj
|
||||||
});
|
});
|
||||||
return okMsg;
|
return okMsg;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,40 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="telegram-chat-thread" class="form-label">{{ $t("Thread ID") }}</label>
|
||||||
|
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<input id="telegram-chat-thread" v-model="$parent.notification.telegramChatThread" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("Thread ID Description") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input v-model="$parent.notification.telegramSilentNotification" class="form-check-input" type="checkbox">
|
||||||
|
<label class="form-check-label">{{ $t("Silent Notification") }}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("Silent Notification Description") }}
|
||||||
|
</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("Protect Forwarding") }}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("Protect Forwarding Description") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -216,6 +216,12 @@ export default {
|
||||||
supportTelegramChatID: "Support Direct Chat / Group / Channel's 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:",
|
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",
|
"YOUR BOT TOKEN HERE": "YOUR BOT TOKEN HERE",
|
||||||
|
"Silent Notification": "Silent Notification",
|
||||||
|
"Silent Notification Description": "If enabled, the notification in Telegram will be without sound.",
|
||||||
|
"Protect Forwarding": "Protect Forwarding",
|
||||||
|
"Protect Forwarding Description": "If enabled, the notification in Telegram will be protected from forwarding and saving.",
|
||||||
|
"Thread ID": "Thread ID (optional)",
|
||||||
|
"Thread ID Description": "Since November 5 2022, bots can send messages to a specific thread. You can get the thread ID by clicking on the thread name in the chat.",
|
||||||
chatIDNotFound: "Chat ID is not found; please send a message to this bot first",
|
chatIDNotFound: "Chat ID is not found; please send a message to this bot first",
|
||||||
webhook: "Webhook",
|
webhook: "Webhook",
|
||||||
"Post URL": "Post URL",
|
"Post URL": "Post URL",
|
||||||
|
|
Loading…
Reference in a new issue