refactor!: handler 参数只按模型/Event/组件注入,不再回退传原始 d

解析不到的形参(无标注或标注三者皆非)在分发时抛 ValueError,经异常
隔离记日志;原始数据经 Event 的 .raw/.typed 自取。同步四处文档与测试。
This commit is contained in:
snowy-yang committed 2026-09-24 22:40:37 +08:00
1 parent 1d9f509b25
commit 0f3ed09233
7 files changed
+46 -60

No files matched your search

-15
View File
@@ -179,21 +179,6 @@ async def test_typed_annotation_receives_dataclass():
assert received[0].group_openid == "G1"
async def test_untyped_annotation_still_receives_raw_dict():
queue = EventQueue()
emitter = EventEmitter(queue)
received: list[dict] = []
@emitter.on("GROUP_AT_MESSAGE_CREATE")
async def handler(d):
received.append(d)
await emitter.emit(
{"op": Opcode.DISPATCH, "t": "GROUP_AT_MESSAGE_CREATE", "d": {"content": "x"}}
)
assert received == [{"content": "x"}]
def test_parse_group_member_and_join_request_events():
from qqbotsdk.payloads import (
GroupJoinRequest,