mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
更新更新
This commit is contained in:
@@ -24,6 +24,7 @@ class CQBot
|
||||
public function __construct(Framework $framework, $package) {
|
||||
$this->starttime = microtime(true);
|
||||
$this->framework = $framework;
|
||||
if ($package === null) return;
|
||||
$this->data = $package;
|
||||
$this->current_id = $this->data["self_id"];
|
||||
if ($package["post_type"] == "message") {
|
||||
|
||||
@@ -19,6 +19,11 @@ class CQUtil
|
||||
Buffer::set("time_send", false);//发送Timing数据到管理群
|
||||
Buffer::set("cmd_prefix", DP::getJsonData("config.json")["cmd_prefix"] ?? "");//设置指令的前缀符号
|
||||
Buffer::set("res_code", file_get_contents(WORKING_DIR . "src/cqbot/Framework.php"));
|
||||
foreach (self::getMods() as $v) {
|
||||
if (in_array("initValues", get_class_methods($v))) {
|
||||
$v::initValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function saveAllFiles() {
|
||||
@@ -644,4 +649,21 @@ class CQUtil
|
||||
$d = Buffer::get("groups");
|
||||
return $d[$group_id] ?? null;
|
||||
}
|
||||
|
||||
static function getCQ($msg) {
|
||||
if (($start = mb_strpos($msg, '[')) === false) return null;
|
||||
if (($end = mb_strpos($msg, ']')) === false) return null;
|
||||
$msg = mb_substr($msg, $start + 1, $end - $start - 1);
|
||||
if (mb_substr($msg, 0, 3) != "CQ:") return null;
|
||||
$msg = mb_substr($msg, 3);
|
||||
$msg2 = explode(",", $msg);
|
||||
$type = array_shift($msg2);
|
||||
$array = [];
|
||||
foreach ($msg2 as $k => $v) {
|
||||
$ss = explode("=", $v);
|
||||
$sk = array_shift($ss);
|
||||
$array[$sk] = implode("=", $ss);
|
||||
}
|
||||
return ["type" => $type, "params" => $array, "start" => $start, "end" => $end];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user