<?php
/* (C) Copyright 2004 Armond Carroll. All rights reserved.
Distributed under the BSD License. Please see license.txt for license,
or http://www.opensource.org/licenses/bsd-license.php.
http://mpibot.sourceforge.net
Purpose of this file:
To preform prerequisites for the bot, and start it up.
File Version: 1.6
Last Modified: 4/30/2004 3:34AM
*/
require('system/essential.php');
// Setup output options. This *should* be in the configuration file,
// but currently isn't due to the initialization procedures.
$output = OL_FATAL | OL_WARNING | OL_NOTICE | OL_INFO;
// If we are running in the web environment ...
if(php_sapi_name() != 'cli') {
header('Content-Type: text/plain');
ob_implicit_flush();
set_time_limit(0);
out('Not running in a CLI environment.', OL_NOTICE);
}
// Figure out what configuration file to use
if(count($argv) <= 1) {
$config_file = 'MPIBot.conf';
} elseif(count($argv) == 2) {
$config_file = $argv[1];
} else {
$config_file = $argv[1];
error("Got some extra parameters. Ignoring the rest and using $config_file as the configuration file.", notice);
}
echo EOL;
out('Welcome to MPIBot/' . MPI_VERSION);
out('Started ' . date('m/d/y h:i:sA'));
$config = new MPIConfig($config_file);
$cfg = $config->cfg;
$bot = new MPIBot();
$bot->init();
while(1) {
$bot->connect();
$bot->main();
$bot->quit();
}
?>