-
Notifications
You must be signed in to change notification settings - Fork 1
/
getUpdates.php
executable file
·47 lines (34 loc) · 1.29 KB
/
getUpdates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/php
<?php
/**
* Telegram Bot Example whitout WebHook.
* It uses getUpdates Telegram's API.
* designed starting from https://github.com/Eleirbag89/TelegramBotPHP
Done! Congratulations on your new bot.
You will find it at telegram.me/emergenzeprato_bot.
You can now add a description, about section and profile picture for your bot, see /help for a list of commands.
Use this token to access the HTTP API:
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
*/
//include('settings_t.php');
include("main.php");
//aggiorna con getUpdates
function getUpdates($telegram){
date_default_timezone_set('Europe/Rome');
$today = date("Y-m-d H:i:s");
$db = new PDO(DB_NAME);
$update_manager= new mainloop();
// Get all the new updates and set the new correct update_id
$req = $telegram->getUpdates();
for ($i = 0; $i < $telegram-> UpdateCount(); $i++) {
// You NEED to call serveUpdate before accessing the values of message in Telegram Class
$telegram->serveUpdate($i);
$text = $telegram->Text();
$chat_id = $telegram->ChatID();
$user_id= $telegram->User_id();
$location= $telegram->Location();
$reply_to_msg= $telegram->ReplyToMessage();
$update_manager->shell($telegram,$db,$text,$chat_id,$user_id,$location,$reply_to_msg);
}
}
?>