Example #1
0
// welcome the user
echo "Welcome to Awesome IRC Bot v2\n";
echo "http://github.com/JackHarley/AwesomeIRCBot\n";
// import all modules
ModuleManager::initialize();
// get a server instance
$server = Server::getInstance();
// setup database
if (!is_file(__DIR__ . "/config.php")) {
    die("\nYou need to rename config.php.example to config.php and edit the settings to match your MySQL database\n");
}
include_once __DIR__ . "/config.php";
$db = Database::getInstance();
$db->updateScriptArrays();
// configure
Config::initializeRequiredValues();
// update database
$db->updateDatabase();
echo "\n";
$lastUpdate = time();
while (true) {
    // Connect
    $server->connect();
    // Identify
    $server->identify();
    // If we send anything else too soon after identification it could be
    // lost, so sleep for 2 seconds
    sleep(2);
    // NickServ
    if (Config::getValue("nickservPassword")) {
        $server->identifyWithNickServ();