Update set_webhook.html
Browse files- set_webhook.html +26 -0
set_webhook.html
CHANGED
@@ -19,6 +19,7 @@
|
|
19 |
<br><br>
|
20 |
|
21 |
<button onclick="activateWebhook()">Активировать Webhook</button>
|
|
|
22 |
|
23 |
<p id="result"></p>
|
24 |
|
@@ -51,7 +52,32 @@
|
|
51 |
document.getElementById("result").innerText = "Ошибка: " + error.message;
|
52 |
});
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</script>
|
55 |
</body>
|
56 |
</html>
|
57 |
|
|
|
|
19 |
<br><br>
|
20 |
|
21 |
<button onclick="activateWebhook()">Активировать Webhook</button>
|
22 |
+
<button onclick="deactivateWebhook()">Отключить Webhook</button>
|
23 |
|
24 |
<p id="result"></p>
|
25 |
|
|
|
52 |
document.getElementById("result").innerText = "Ошибка: " + error.message;
|
53 |
});
|
54 |
}
|
55 |
+
|
56 |
+
function deactivateWebhook() {
|
57 |
+
const token = document.getElementById("token").value;
|
58 |
+
if (!token) {
|
59 |
+
document.getElementById("result").innerText = "Введите токен!";
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
// Отправляем запрос на Telegram API для удаления webhook
|
64 |
+
const apiUrl = `https://api.telegram.org/bot${token}/deleteWebhook`;
|
65 |
+
|
66 |
+
fetch(apiUrl)
|
67 |
+
.then(response => response.json())
|
68 |
+
.then(result => {
|
69 |
+
if (result.ok) {
|
70 |
+
document.getElementById("result").innerText = "Webhook отключен успешно!";
|
71 |
+
} else {
|
72 |
+
document.getElementById("result").innerText = `Ошибка: ${result.description}`;
|
73 |
+
}
|
74 |
+
})
|
75 |
+
.catch(error => {
|
76 |
+
document.getElementById("result").innerText = "Ошибка: " + error.message;
|
77 |
+
});
|
78 |
+
}
|
79 |
</script>
|
80 |
</body>
|
81 |
</html>
|
82 |
|
83 |
+
|