Skip to content

Commit

Permalink
update to 2.0.3 version
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc committed Dec 31, 2020
1 parent ac45ab0 commit 7434bac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "High performance QQ robot and web server development framework",
"minimum-stability": "stable",
"license": "Apache-2.0",
"version": "2.0.2",
"version": "2.0.3",
"extra": [],
"authors": [
{
Expand Down
15 changes: 14 additions & 1 deletion docs/update/v2.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# 更新日志(v2 版本)

## v2.0.3

> 更新事件:2020.12.31
- 修复:CQBefore 注解事件在 level 低于 200 时无法调用的 bug
- 修复:CQMetaEvent 注解事件调用时报错的 bug

## v2.0.2

> 更新时间:2020.12.31
- 更新:将 CQ 码调用类更新到与最新 OneBot 标准相兼容的状态

## v2.0.1

> 更新事件:2020.12.23
> 更新时间:2020.12.23
- 修复:开屏报错文件夹不存在

Expand Down
7 changes: 2 additions & 5 deletions src/ZM/Module/QQBot.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ public function handle() {
public function dispatchBeforeEvents($data) {
$before = new EventDispatcher(CQBefore::class);
$before->setRuleFunction(function ($v) use ($data) {
if ($v->level < 200) EventDispatcher::interrupt();
elseif ($v->cq_event != $data["post_type"]) return false;
return true;
return $v->cq_event == $data["post_type"];
});
$before->setReturnFunction(function ($result) {
if (!$result) EventDispatcher::interrupt();
Expand Down Expand Up @@ -137,8 +135,7 @@ private function dispatchEvents($data) {
//Console::success("当前数据包:".json_encode(ctx()->getData()));
$dispatcher = new EventDispatcher(CQMetaEvent::class);
$dispatcher->setRuleFunction(function (CQMetaEvent $v) {
return ($v->meta_event_type == '' || ($v->meta_event_type != '' && $v->meta_event_type == ctx()->getData()["meta_event_type"])) &&
($v->sub_type == '' || ($v->sub_type != '' && $v->sub_type == (ctx()->getData()["sub_type"] ?? '')));
return ($v->meta_event_type == '' || ($v->meta_event_type != '' && $v->meta_event_type == ctx()->getData()["meta_event_type"]));
});
//eval(BP);
$dispatcher->dispatchEvents(ctx()->getData());
Expand Down

0 comments on commit 7434bac

Please sign in to comment.