-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcrontab.php
More file actions
42 lines (38 loc) · 1.28 KB
/
crontab.php
File metadata and controls
42 lines (38 loc) · 1.28 KB
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
<?php
$start_time = microtime(true);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
ini_set('error_log', __DIR__ . '/logs.txt');
ini_set('ignore_repeated_errors', 1);
require_once('configs.php');
require_once('errorHandler.php');
require_once('TelegramBot.php');
require_once('Variables.php');
require_once('Database.php');
require_once('AntiFlood.php');
require_once('NeleBotX.php');
# Initialize framework
try {
# Here you have to set the token or get in a more secure way.
$configs['token'] = '';
$NeleBotX = new NeleBotX($configs);
$bot = $NeleBotX->api;
$db = $NeleBotX->db;
# Variables not available:
$v = $NeleBotX->v;
$user = $NeleBotX->user;
$group = $NeleBotX->group;
$channel = $NeleBotX->channel;
} catch (Exception $e) {
# Bot Exceptions
$NeleBotX->response = ['ok' => false, 'error_code' => 500, 'description' => 'Class Error: ' . $e->getMessage()];
}
if (!$NeleBotX->response['ok']) {
if ($NeleBotX->response['error_code'] != 429) $bot->sendLog($bot->bold('The Bot crontab was stopped!') . PHP_EOL . $bot->code($NeleBotX->response['description'], 1));
die($NeleBotX->response['error_code']);
} else {
# Test
$bot->sendMessage($v->configs['admins'][0], 'Testing my crontab!');
}
?>