Dooratre commited on
Commit
9148cb8
·
verified ·
1 Parent(s): 7b43ce2

Delete templates/ai-chat-bot.html

Browse files
Files changed (1) hide show
  1. templates/ai-chat-bot.html +0 -66
templates/ai-chat-bot.html DELETED
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Telegram Bot</title>
5
- </head>
6
- <body>
7
- <h1>BOT TELE RUN</h1>
8
-
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.js"></script>
10
- <script>
11
- // Replace 'YOUR_BOT_TOKEN' with your actual bot token
12
- const botToken = '6990801595:AAE79xNVO1D_0SeWZlzYLE57Suwfp9GyKT8';
13
-
14
- function sendMessage(chatId, text) {
15
- const url = `https://api.telegram.org/bot${botToken}/sendMessage`;
16
- const params = { chat_id: chatId, text: text };
17
-
18
- axios.get(url, { params })
19
- .then(response => {
20
- console.log(response.data);
21
- })
22
- .catch(error => {
23
- console.error(error);
24
- });
25
- }
26
-
27
- function handleMessage(message) {
28
- const chatId = message.chat.id;
29
- const text = message.text;
30
-
31
- if (text === '/start') {
32
- sendMessage(chatId, 'Hi');
33
- }
34
- }
35
-
36
- function main() {
37
- let offset = null;
38
-
39
- setInterval(() => {
40
- const url = `https://api.telegram.org/bot${botToken}/getUpdates`;
41
- const params = { offset };
42
-
43
- axios.get(url, { params })
44
- .then(response => {
45
- const data = response.data;
46
-
47
- if (data.ok) {
48
- for (const update of data.result) {
49
- offset = update.update_id + 1;
50
-
51
- if (update.message) {
52
- handleMessage(update.message);
53
- }
54
- }
55
- }
56
- })
57
- .catch(error => {
58
- console.error(error);
59
- });
60
- }, 1000);
61
- }
62
-
63
- main();
64
- </script>
65
- </body>
66
- </html>