2018-04-23 15:04:10 +08:00
|
|
|
|
<?php
|
2018-06-03 15:40:28 +08:00
|
|
|
|
|
|
|
|
|
|
//工作目录设置
|
2018-04-28 16:20:44 +08:00
|
|
|
|
define("WORKING_DIR", __DIR__ . "/");
|
|
|
|
|
|
define("CONFIG_DIR", WORKING_DIR . "config/");
|
|
|
|
|
|
define("USER_DIR", WORKING_DIR . "users");
|
2018-06-03 15:40:28 +08:00
|
|
|
|
|
2018-06-15 09:18:53 +08:00
|
|
|
|
require("tools.php");
|
2018-04-28 16:20:44 +08:00
|
|
|
|
|
|
|
|
|
|
//loading projects
|
|
|
|
|
|
require(WORKING_DIR . "src/cqbot/Framework.php");
|
|
|
|
|
|
require(WORKING_DIR . "src/cqbot/utils/Buffer.php");
|
|
|
|
|
|
require(WORKING_DIR . "src/cqbot/utils/ErrorStatus.php");
|
|
|
|
|
|
require(WORKING_DIR . "src/cqbot/utils/Console.php");
|
2018-04-23 15:04:10 +08:00
|
|
|
|
|
2018-06-15 09:18:53 +08:00
|
|
|
|
//初始参数设置:host、端口、多个机器人号对应的admin_group、事件等级、多个机器人号对应的超级管理员
|
|
|
|
|
|
$properties["host"] = "0.0.0.0";
|
|
|
|
|
|
$properties["port"] = 20000;
|
|
|
|
|
|
$properties["admin_group"] = [];
|
|
|
|
|
|
$properties["info_level"] = 1;
|
|
|
|
|
|
$properties["super_user"] = [];
|
|
|
|
|
|
|
|
|
|
|
|
$json = json_decode(file_get_contents(CONFIG_DIR . "config.json"), true);
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($json["host"]) || !isset($json["port"])) setupWizard($json, $properties);
|
|
|
|
|
|
|
|
|
|
|
|
//initializing framework
|
2018-04-28 16:20:44 +08:00
|
|
|
|
$cqbot = new Framework();
|
2018-06-15 09:18:53 +08:00
|
|
|
|
$cqbot->setHost($properties["host"]);
|
|
|
|
|
|
$cqbot->setEventPort($properties["port"]);
|
|
|
|
|
|
$cqbot->setAdminGroup($properties["admin_group"]);
|
|
|
|
|
|
$cqbot->setInfoLevel($properties["info_level"]);
|
|
|
|
|
|
$cqbot->setSuperUser($properties["super_user"]);
|
|
|
|
|
|
$cqbot->init();
|
2018-04-28 16:20:44 +08:00
|
|
|
|
$cqbot->eventServerStart();
|