Ejemplo n.º 1
0
    $config = (include_once ROOT_DIR . '/config.local.php');
} else {
    $config = (include_once ROOT_DIR . '/config.php');
}
require $config['mangaApi'];
spl_autoload_register('Autoloader::load');
// Create the bot.
$bot = new Library\IRC\Bot();
// Configure the bot.
$bot->setServer($config['server']);
$bot->setPort($config['port']);
$bot->setChannel($config['channels']);
$bot->setName($config['name']);
$bot->setNick($config['nick']);
$bot->setMaxReconnects($config['max_reconnects']);
$bot->setLogFile($config['log_file']);
$bot->setNickPassword($config['nickPassword']);
// Add commands to the bot.
foreach ($config['commands'] as $commandName => $args) {
    $reflector = new ReflectionClass($commandName);
    $command = $reflector->newInstanceArgs($args);
    $bot->addCommand($command);
}
foreach ($config['listeners'] as $listenerName => $args) {
    $reflector = new ReflectionClass($listenerName);
    $listener = $reflector->newInstanceArgs($args);
    $bot->addListener($listener);
}
if (function_exists('setproctitle')) {
    $title = basename(__FILE__, '.php') . ' - ' . $config['nick'];
    setproctitle($title);