-
Notifications
You must be signed in to change notification settings - Fork 0
/
hook.php
43 lines (33 loc) · 1.08 KB
/
hook.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
<?php
$API_KEY = '';
$BOT_NAME = 'Schaffenbot';
$admin_id = ; //userid von admin
//$GROUP_ID = -204065026; // bot test group
$GROUP_ID = -191031802; // schaffen cix
$BOT_URL = "https://api.telegram.org/bot" . $API_KEY . "/sendMessage";
$hook_url = ''; //url zur hook.php
$mysql_credentials = [
'host' => 'localhost',
'user' => '',
'password' => '',
'database' => '',
];
require __DIR__ . '/../vendor/autoload.php';
$commands_path = __DIR__ . '/commands/';
try {
// Create Telegram API object
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
// add custom commands
$commands_folder = __DIR__ . '/commands/';
$telegram->addCommandsPath($commands_folder);
// Enable MySQL
$telegram->enableMySql($mysql_credentials);
$telegram->enableAdmin($admin_id);
Longman\TelegramBot\TelegramLog::initUpdateLog($BOT_NAME . '_update.log');
// Handle telegram webhook request
$telegram->handle();
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
// Silence is golden!
// log telegram errors
// echo $e;
}