forked from banghasan/phpbottelegram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.php
60 lines (42 loc) · 1.08 KB
/
bot.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
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
define('HS', true);
/*
* Programmer : Hasanudin HS
* Email : [email protected]
* Telegram : @hasanudinhs
*
* Name : Template bot telegram - php
* Fungsi : Sample bot API
* Pembuatan : Mei 2016
*
* File : bot.php
* Tujuan : bot poll untuk telegram
* ____________________________________________________________
*/
require_once 'bot-api-config.php';
require_once 'bot-api-fungsi.php';
require_once 'bot-api-proses.php';
/* ----------------- MULAI LOOPING
Jika tidak ada pesan masuk ditandai -
Jika ada pesan masuk pada console ditandai +
*/
function myloop()
{
global $debug;
$idfile = 'botposesid.txt';
$update_id = 0;
if (file_exists($idfile)) {
$update_id = (int) file_get_contents($idfile);
echo '-';
}
$updates = getApiUpdate($update_id);
foreach ($updates as $message) {
$update_id = prosesApiMessage($message);
echo '+';
}
file_put_contents($idfile, $update_id + 1);
}
while (true) {
myloop();
}
// Telegram by: banghasan @hasanudinhs @myqers;