Update index.html
Browse files- index.html +17 -16
index.html
CHANGED
@@ -30,26 +30,27 @@
|
|
30 |
}
|
31 |
function main() {
|
32 |
let offset = null;
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
.
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
}
|
44 |
}
|
45 |
-
}
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
}
|
51 |
main();
|
52 |
-
setInterval(main, 1000);
|
53 |
</script>
|
54 |
</body>
|
55 |
</html>
|
|
|
30 |
}
|
31 |
function main() {
|
32 |
let offset = null;
|
33 |
+
setInterval(() => {
|
34 |
+
const url = `https://api.telegram.org/bot${botToken}/getUpdates`;
|
35 |
+
const params = { offset };
|
36 |
+
axios.get(url, { params })
|
37 |
+
.then(response => {
|
38 |
+
const data = response.data;
|
39 |
+
if (data.ok) {
|
40 |
+
for (const update of data.result) {
|
41 |
+
offset = update.update_id + 1;
|
42 |
+
if (update.message) {
|
43 |
+
handleMessage(update.message);
|
44 |
+
}
|
45 |
}
|
46 |
}
|
47 |
+
})
|
48 |
+
.catch(error => {
|
49 |
+
console.error(error);
|
50 |
+
});
|
51 |
+
}, 1000);
|
52 |
}
|
53 |
main();
|
|
|
54 |
</script>
|
55 |
</body>
|
56 |
</html>
|