/**
  * Waits for and gets a reply from the server.
  * THIS HALTS THE TIMERS FOR THE SPECIFIED TIME.
  * @param int $lines The amount of lines to listen for.
  * @param int $timeout Timeout for listening to data. Defaults to 3 seconds.
  * @return ServerMessage[]
  */
 public function waitReply($lines = 1, $timeout = 3)
 {
     return $this->bot->waitReply($lines, $timeout);
 }
Beispiel #2
0
}
// Check if we are running high enough PHP version
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    echo 'The PHP version you are running (' . PHP_VERSION . ') is not sufficient for WildPHP. Sorry.';
    echo 'Please use PHP 5.5.0 or later.';
    exit(129);
}
// Define global constants
define('WPHP_ROOT_DIR', __DIR__ . '/');
define('WPHP_LIB_DIR', WPHP_ROOT_DIR . 'lib/');
define('WPHP_MODULE_DIR', WPHP_ROOT_DIR . 'modules/');
define('WPHP_LOG_DIR', WPHP_ROOT_DIR . 'logs/');
define('WPHP_CONFIG', WPHP_ROOT_DIR . 'config.neon');
// Turn all PHP errors into exceptions
set_error_handler(function ($errNo, $errStr, $errFile, $errLine) {
    throw new ErrorException($errStr . ' in ' . $errFile . ' on line ' . $errLine, $errNo);
});
// Register the autoloader
require_once 'vendor/autoload.php';
// Create a new bot and start it up
$bot = new Bot();
$parser = new DotModulesParser();
$result = $parser->readFile(dirname(__FILE__) . '/main.modules');
if (!empty($result)) {
    $router = new DotModulesRouter();
    $modules = $router->routeAll($result);
    if (!empty($modules)) {
        $bot->addModules($modules);
    }
}
$bot->start();
Beispiel #3
0
 /**
  * Sends a message to the log.
  * @param string $message the message to be logged.
  * @param array $context The context to use.
  * @param string $level The level to log at. Defaults to debug.
  */
 protected function log($message, $context = array(), $level = LogLevels::DEBUG)
 {
     $this->bot->log($message, $context, $level);
 }
Beispiel #4
0
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
use WildPHP\Bot;
// Set error reporting to report all errors
error_reporting(E_ALL);
// Check if we are running as root and quit
if (function_exists('posix_getuid') && posix_getuid() === 0) {
    echo 'Running wildphp as root is not allowed.' . PHP_EOL;
    exit(128);
}
// Check if we are running high enough PHP version
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    echo 'The PHP version you are running (' . PHP_VERSION . ') is not sufficient for WildPHP. Sorry.';
    echo 'Please use PHP 5.5.0 or later.';
    exit(129);
}
// Define global constants
define('WPHP_ROOT_DIR', __DIR__ . '/');
define('WPHP_LIB_DIR', WPHP_ROOT_DIR . 'lib/');
define('WPHP_MODULE_DIR', WPHP_ROOT_DIR . 'modules/');
define('WPHP_LOG_DIR', WPHP_ROOT_DIR . 'logs/');
define('WPHP_CONFIG', WPHP_ROOT_DIR . 'config.neon');
// Turn all PHP errors into exceptions
set_error_handler(function ($errNo, $errStr, $errFile, $errLine) {
    throw new ErrorException($errStr . ' in ' . $errFile . ' on line ' . $errLine, $errNo);
});
// Register the autoloader
require_once 'vendor/autoload.php';
// Create a new bot and start it up
$bot = new Bot();
$bot->start();
Beispiel #5
0
*/
use WildPHP\Bot;
// Set error reporting to report all errors
error_reporting(E_ALL);
// Check if we are running as root and quit
if (function_exists('posix_getuid') && posix_getuid() === 0) {
    echo 'Running wildphp as root is not allowed.' . PHP_EOL;
    exit(128);
}
// Check if we are running high enough PHP version
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
    echo 'The PHP version you are running (' . PHP_VERSION . ') is not sufficient for WildPHP. Sorry.';
    echo 'Please use PHP 5.3.9 or later.';
    exit(129);
}
// Define global constants
define('WPHP_ROOT_DIR', __DIR__ . '/');
define('WPHP_LIB_DIR', WPHP_ROOT_DIR . 'lib/');
define('WPHP_MODULE_DIR', WPHP_ROOT_DIR . 'modules/');
define('WPHP_LOG_DIR', WPHP_ROOT_DIR . 'logs/');
define('WPHP_CONFIG', WPHP_ROOT_DIR . 'config.neon');
// Turn all PHP errors into exceptions
set_error_handler(function ($errNo, $errStr, $errFile, $errLine) {
    throw new ErrorException($errStr . ' in ' . $errFile . ' on line ' . $errLine, $errNo);
});
// Register the autoloader
require_once 'vendor/autoload.php';
// Create a new bot and start it up
$bot = new Bot();
$bot->connect();
$bot->start();