mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-04 23:35:35 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
504934f057 |
@@ -3,7 +3,7 @@
|
||||
"description": "High performance QQ robot and web server development framework",
|
||||
"minimum-stability": "stable",
|
||||
"license": "Apache-2.0",
|
||||
"version": "1.5.7",
|
||||
"version": "1.5.8",
|
||||
"authors": [
|
||||
{
|
||||
"name": "whale",
|
||||
|
||||
@@ -19,6 +19,8 @@ class CQCommand extends AnnotationBase implements Level
|
||||
public $match = "";
|
||||
/** @var string */
|
||||
public $regexMatch = "";
|
||||
/** @var string */
|
||||
public $fullMatch = "";
|
||||
/** @var string[] */
|
||||
public $alias = [];
|
||||
/** @var string */
|
||||
|
||||
@@ -100,7 +100,7 @@ class MessageEvent
|
||||
$obj = [];
|
||||
foreach (ZMBuf::$events[CQCommand::class] ?? [] as $v) {
|
||||
/** @var CQCommand $v */
|
||||
if ($v->match == "" && $v->regexMatch == "") continue;
|
||||
if ($v->match == "" && $v->regexMatch == "" && $v->fullMatch == "") continue;
|
||||
elseif (($v->user_id == 0 || ($v->user_id != 0 && $v->user_id == context()->getData()["user_id"])) &&
|
||||
($v->group_id == 0 || ($v->group_id != 0 && $v->group_id == (context()->getData()["group_id"] ?? 0))) &&
|
||||
($v->discuss_id == 0 || ($v->discuss_id != 0 && $v->discuss_id == (context()->getData()["discuss_id"] ?? 0))) &&
|
||||
@@ -135,6 +135,14 @@ class MessageEvent
|
||||
return true;
|
||||
});
|
||||
return;
|
||||
} elseif ($v->fullMatch != "" && (preg_match("/".$v->fullMatch."/u", ctx()->getMessage(), $args)) != 0) {
|
||||
Console::debug("Calling $c -> {$v->method}");
|
||||
array_shift($args);
|
||||
$this->function_call = EventHandler::callWithMiddleware($obj[$c], $v->method, $class_construct, [$args], function ($r) {
|
||||
if (is_string($r)) context()->reply($r);
|
||||
return true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user