-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.php
69 lines (56 loc) · 2.37 KB
/
index.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
61
62
63
64
65
66
67
68
69
<?php
// Parent dir.
$parent = __DIR__;
// Include requirements and perfom initial steps
include_once(__DIR__ . '/core/bot/requirements.php');
// Start logging.
debug_log("QUEST-BOT '" . $config->BOT_ID . "'");
// Check API Key and get input from telegram
include_once(CORE_BOT_PATH . '/apikey.php');
// DDOS protection
include_once(CORE_BOT_PATH . '/ddos.php');
// Get language
include_once(CORE_BOT_PATH . '/userlanguage.php');
// Database connection
include_once(CORE_BOT_PATH . '/db.php');
// Run cleanup if requested
include_once(CORE_BOT_PATH . '/cleanup_run.php');
// Update the user
update_user($update);
// Callback query received.
if (isset($update['callback_query'])) {
// Logic to get the module
include_once(CORE_BOT_PATH . '/modules.php');
// Inline query received.
} else if (isset($update['inline_query'])) {
// List inline search results and exit.
inline_list($update);
exit();
// Location received.
} else if (isset($update['message']['location']) && $update['message']['chat']['type'] == 'private') {
// Ask for quest or invasion and exit.
if($config->QUEST_VIA_LOCATION && $config->INVASION_VIA_LOCATION) {
include_once(ROOT_PATH . '/mods/geo.php');
// Create quest and exit.
} else if($config->QUEST_VIA_LOCATION) {
include_once(ROOT_PATH . '/mods/quest_geo.php');
// Create invasion and exit.
} else if($config->INVASION_VIA_LOCATION) {
include_once(ROOT_PATH . '/mods/invasion_geo.php');
}
exit();
// Cleanup collection from channel/supergroup messages.
} else if ((isset($update['channel_post']) && $update['channel_post']['chat']['type'] == "channel") || (isset($update['message']) && $update['message']['chat']['type'] == "supergroup")) {
// Collect cleanup information
include_once(CORE_BOT_PATH . '/cleanup_collect.php');
// Message is required to check for commands.
} else if (isset($update['message']) && $update['message']['chat']['type'] == 'private') {
// Portal message?
if(isset($update['message']['entities']['1']['type']) && $update['message']['entities']['1']['type'] == 'text_link' && strpos($update['message']['entities']['1']['url'], 'https://intel.ingress.com/intel?ll=') === 0) {
// Import portal.
include_once(ROOT_PATH . '/mods/importal.php');
} else {
// Logic to get the command
include_once(CORE_BOT_PATH . '/commands.php');
}
}