Exemplo n.º 1
0
Arquivo: bot.php Projeto: numb95/pmg
    // Loop through the channels in the config and join them
    foreach (Config::$channels as $channel) {
        $server->join($channel);
    }
    // Loop-edy-loop
    $cntUpd = 0;
    while ($server->connected()) {
        $line = $server->getNextLine();
        $line = new ReceivedLine($line);
        $line->parse();
        if ($line->isCommand()) {
            $command = new Command($line);
            $command->execute();
        }
        if ($line->isMappedEvent()) {
            $event = new Event($line);
            $event->execute();
        }
        if ($line->isMappedTrigger()) {
            $trigger = new Trigger($line);
            $trigger->execute();
        }
        $cntUpd++;
        if ($cntUpd > 1000) {
            $db->updateDatabase();
            $cntUpd = 0;
        }
    }
    // Disconnected, Give the server 2 seconds before we attempt a reconnect
    sleep(2);
}
Exemplo n.º 2
0
    $channels = Config::getValue("channels");
    foreach ($channels as $channel) {
        $server->join($channel);
    }
    // Loop-edy-loop
    while ($server->connected()) {
        $line = $server->getNextLine();
        $line = new ReceivedLine($line);
        $line->parse();
        if ($line->isMappedCommand()) {
            $command = new Command($line);
            $command->execute();
        }
        if ($line->isMappedEvent()) {
            $event = new Event($line);
            $event->execute();
        }
        if ($line->isMappedTrigger()) {
            $trigger = new Trigger($line);
            $trigger->execute();
        }
        if (time() - 2 >= $lastUpdate) {
            $db->updateScriptArrays();
            $db->updateDatabase();
            $lastUpdate = time();
        }
        unset($command, $event, $trigger);
    }
    // Disconnected, Give the server 1 second before we attempt a reconnect
    sleep(1);
}