-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.php
41 lines (32 loc) · 1004 Bytes
/
cron.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
<?php
require __DIR__ . '/../vendor/autoload.php';
$API_KEY = '';
$BOT_NAME = 'Schaffenbot';
$admin_id = ; //userid von admin
$mysql_credentials = [
'host' => 'localhost',
'user' => '',
'password' => '',
'database' => '',
];
$commands_path = __DIR__ . '/commands/';
$commands[] = '/spacestatus';
try {
// Create Telegram API object
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
// Enable MySQL
$telegram->enableMySql($mysql_credentials);
// Add an additional commands path
$telegram->addCommandsPath($commands_path);
// Run user selected commands
$telegram->runCommands($commands);
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
// Silence is golden!
//echo $e;
// Log telegram errors
Longman\TelegramBot\TelegramLog::error($e);
} catch (Longman\TelegramBot\Exception\TelegramLogException $e) {
// Silence is golden!
// Uncomment this to catch log initilization errors
//echo $e;
}