mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 15:45:36 +08:00
add CQCommand alias
switch spl_autoload to psr-4 autoload
This commit is contained in:
@@ -40,7 +40,7 @@ class MessageEvent
|
||||
public function onBefore() {
|
||||
$obj_list = ZMBuf::$events[CQBefore::class]["message"] ?? [];
|
||||
foreach ($obj_list as $v) {
|
||||
if($v->level < 200) break;
|
||||
if ($v->level < 200) break;
|
||||
EventHandler::callWithMiddleware(
|
||||
$v->class,
|
||||
$v->method,
|
||||
@@ -65,7 +65,7 @@ class MessageEvent
|
||||
}
|
||||
}
|
||||
foreach (ZMBuf::$events[CQBefore::class]["message"] ?? [] as $v) {
|
||||
if($v->level >= 200) continue;
|
||||
if ($v->level >= 200) continue;
|
||||
$c = $v->class;
|
||||
if (ctx()->getCache("level") != 0) continue;
|
||||
EventHandler::callWithMiddleware(
|
||||
@@ -117,6 +117,13 @@ class MessageEvent
|
||||
return true;
|
||||
});
|
||||
return;
|
||||
} elseif (in_array($word[0], $v->alias)) {
|
||||
Console::debug("Calling $c -> {$v->method}");
|
||||
$this->function_call = EventHandler::callWithMiddleware($obj[$c], $v->method, $class_construct, [$word], function ($r) {
|
||||
if (is_string($r)) context()->reply($r);
|
||||
return true;
|
||||
});
|
||||
return;
|
||||
} elseif ($v->regexMatch != "" && ($args = matchArgs($v->regexMatch, context()->getMessage())) !== false) {
|
||||
Console::debug("Calling $c -> {$v->method}");
|
||||
$this->function_call = EventHandler::callWithMiddleware($obj[$c], $v->method, $class_construct, [$args], function ($r) {
|
||||
|
||||
Reference in New Issue
Block a user