-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlistener.php
executable file
·46 lines (36 loc) · 1.06 KB
/
listener.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
<?php
include("include.php");
global $pluginManager;
global $message;
global $msg;
global $api;
global $sender;
global $db;
global $t;
$t = new Translator();
$db = new MySql();
$api = new telegramBot(TELEGRAM_API_TOKEN);
$pluginManager = new PluginManager();
$pluginManager->collectAliases();
if (defined("IS_CRONJOB")) {
// Cronjob running
// TODO
} else {
// Message received
$update = new Update($api->getWebhookUpdates());
if ($update->type == "inlineQuery") {
} else {
$message = $update->message;
$pluginManager->sendReceived($message);
if ($message->is_command) {
$cmd = $message->getCommand();
if (!$cmd) {
exit;
}
$cmd = $pluginManager->resolveAlias($cmd);
$class = new $cmd;
$class->execute($message);
}
}
}
?>