-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot
executable file
·36 lines (31 loc) · 1001 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
29
30
31
32
33
34
35
36
#!/usr/bin/env php
<?php
if (is_file($autoload = getcwd() . '/vendor/autoload.php')) {
require $autoload;
} elseif (is_file($autoload = getcwd() . '/../../autoload.php')) {
require $autoload;
}
if (!file_exists('.env')) {
die("Missing .env file\n");
}
$dotenv = Dotenv\Dotenv::create(__DIR__);
$dotenv->load();
$config = new Choccybiccy\TwitchBot\Config(__DIR__ . '/config/config.yml');
$options = getopt('c:', ['config:']);
if (array_key_exists('c', $options)) {
$config->load($options['c']);
}
if (array_key_exists('config', $options)) {
$config->load($options['config']);
}
$container = new League\Container\Container();
$container->addServiceProvider(
new Choccybiccy\TwitchBot\Provider\ApplicationProvider($config)
);
$providers = $config->get('application.providers');
if (is_array($providers)) {
foreach ($providers as $provider) {
$container->addServiceProvider(new $provider);
}
}
$container->get(Choccybiccy\TwitchBot\Application::class)->run();