mirror of
https://github.com/snowy-yang/qqbotsdk.git
synced 2026-10-21 13:04:49 +00:00
refactor!: 移除 dishka,改为内置裸标注参数注入
- handler 形参直接标注组件类型(api: BotApi)即注入,解析为 emitter 内同步查表(payload dataclass / Event / services 登记类型 / 回退原始 dict)
This commit is contained in:
1 parent
953d44f62e
commit
cff0c142c2
16 files changed
+161
-240
No files matched your search
@@ -11,7 +11,7 @@
|
||||
运行:uv run python examples/webhook_bot/main.py
|
||||
"""
|
||||
|
||||
from qqbotsdk import EventEmitter, EventQueue, Inject, main
|
||||
from qqbotsdk import EventEmitter, EventQueue, main
|
||||
from qqbotsdk.api import BotApi
|
||||
from qqbotsdk.payloads import GroupAtMessage
|
||||
|
||||
@@ -19,7 +19,7 @@ ee = EventEmitter(EventQueue())
|
||||
|
||||
|
||||
@ee.on("GROUP_AT_MESSAGE_CREATE")
|
||||
async def on_group_message(msg: GroupAtMessage, api: Inject[BotApi]) -> None:
|
||||
async def on_group_message(msg: GroupAtMessage, api: BotApi) -> None:
|
||||
if not (msg.group_openid and msg.id):
|
||||
return
|
||||
await api.post_group_message(
|
||||
|
||||
Reference in new issue
Block a user