-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot
28 lines (21 loc) · 717 Bytes
/
bot
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
#!/usr/bin/env php
<?php
use Monolog\Handler\RotatingFileHandler;
use Symfony\Component\Console\Application;
const ROOT = __DIR__;
require ROOT .'/vendor/autoload.php';
$dot = \Dotenv\Dotenv::createImmutable(ROOT );
$dot->load();
$level = isset($_ENV['debug']) ? \Monolog\Logger::DEBUG : \Monolog\Logger::WARNING;
$_ENV['LOG_LEVEL'] = $level;
$logger = new \Monolog\Logger('cli', [
new RotatingFileHandler(ROOT . '/log/telegram.log',5, $level)
]);
$app = new Application();
foreach (scandir(__DIR__ . '/lib/cli/') as $fileName){
if(str_ends_with($fileName, '.php')){
$class = '\\cli\\' . substr($fileName, 0, -4);
$app->add(new $class); // remove .php from filename
}
}
$app->run();