ErisPulse 2.4.6.dev1__tar.gz → 2.4.6.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/PKG-INFO +43 -53
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/README.md +43 -53
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/pyproject.toml +1 -1
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/adapter.py +12 -5
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/adapter.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/module.py +3 -2
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/module.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/base.py +30 -7
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/base.pyi +3 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/command.py +51 -7
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/command.pyi +2 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/message.py +4 -3
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/message.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/meta.py +5 -4
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/meta.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/notice.py +12 -5
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/notice.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/request.py +4 -3
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/request.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/wrapper.py +40 -69
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/wrapper.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/adapter.py +102 -22
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/adapter.pyi +6 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/config.py +4 -3
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/config.pyi +1 -0
- erispulse-2.4.6.dev3/src/ErisPulse/Core/constants.py +448 -0
- erispulse-2.4.6.dev3/src/ErisPulse/Core/constants.pyi +18 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/lifecycle.py +9 -4
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/lifecycle.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/logger.py +4 -3
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/logger.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/module.py +105 -53
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/module.pyi +4 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/router.py +412 -86
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/router.pyi +4 -1
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/storage.py +3 -2
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/storage.pyi +1 -0
- erispulse-2.4.6.dev3/src/ErisPulse/runtime/context.py +33 -0
- erispulse-2.4.6.dev3/src/ErisPulse/runtime/context.pyi +34 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/runtime/exceptions.py +2 -2
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/runtime/frame_config.py +41 -28
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/runtime/frame_config.pyi +1 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/sdk.py +206 -159
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/sdk.pyi +24 -20
- erispulse-2.4.6.dev3/src/ErisPulse/web_status/4xx.png +0 -0
- erispulse-2.4.6.dev3/src/ErisPulse/web_status/5xx.png +0 -0
- erispulse-2.4.6.dev3/src/ErisPulse/web_status/__init__.py +17 -0
- erispulse-2.4.6.dev3/src/ErisPulse/web_status/__init__.pyi +21 -0
- erispulse-2.4.6.dev3/src/ErisPulse/web_status/unknow.png +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/.gitignore +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/LICENSE +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/base.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/base.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/cli.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/cli.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/create.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/create.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/init.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/init.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/install.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/install.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/list.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/list.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/list_remote.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/list_remote.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/run.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/run.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/self_update.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/self_update.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/uninstall.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/uninstall.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/upgrade.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/commands/upgrade.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/console.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/console.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/registry.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/registry.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/utils/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/utils/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/utils/display.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/utils/display.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/utils/package_manager.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/CLI/utils/package_manager.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/manager.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/manager.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/storage.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Bases/storage.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/message_builder.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/message_builder.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/session_type.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/Event/session_type.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/Core/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/__main__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/__main__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/adapter.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/adapter.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/bases/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/bases/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/bases/finder.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/bases/finder.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/module.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/finders/module.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/adapter.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/adapter.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/bases/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/bases/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/bases/loader.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/bases/loader.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/module.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/module.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/strategy.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/loaders/strategy.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/runtime/__init__.py +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/runtime/__init__.pyi +0 -0
- {erispulse-2.4.6.dev1 → erispulse-2.4.6.dev3}/src/ErisPulse/runtime/exceptions.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 2.4.6.
|
|
3
|
+
Version: 2.4.6.dev3
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Author-email: ErisDev <erisdev@88.com>
|
|
6
6
|
Maintainer-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>
|
|
@@ -89,17 +89,18 @@ Description-Content-Type: text/markdown
|
|
|
89
89
|
|
|
90
90
|
> 支持 Vibe Coding 工作流,让 AI 直接生成可用模块 — [查看](docs/zh-CN/ai-support/README.md)
|
|
91
91
|
|
|
92
|
-
[](https://github.com/astral-sh/ruff)
|
|
92
|
+
[](https://pypi.org/project/ErisPulse/)
|
|
93
|
+
[](https://pypi.org/project/ErisPulse/)
|
|
94
|
+
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
95
|
+
[](https://github.com/ErisPulse/ErisPulse/blob/main/LICENSE)
|
|
96
|
+
[](https://github.com/ErisPulse/ErisPulse)
|
|
97
|
+
[](https://pypi.org/project/ErisPulse/)
|
|
98
|
+
[](https://github.com/astral-sh/ruff)
|
|
99
|
+
[](https://socket.dev/pypi/package/erispulse)
|
|
99
100
|
|
|
100
|
-
[](https://www.erisdev.com)
|
|
102
|
+
[](https://www.erisdev.com/#market)
|
|
103
|
+
[](https://github.com/ErisPulse/ErisPulse/discussions)
|
|
103
104
|
|
|
104
105
|
</td>
|
|
105
106
|
</tr>
|
|
@@ -118,7 +119,7 @@ Description-Content-Type: text/markdown
|
|
|
118
119
|
<td width="50%" align="center" valign="top">
|
|
119
120
|
<br/>
|
|
120
121
|
|
|
121
|
-
### 事件驱动架构
|
|
122
|
+
### ⚡ 事件驱动架构
|
|
122
123
|
|
|
123
124
|
基于 OneBot12 标准的清晰事件模型,让消息处理逻辑更加直观和高效
|
|
124
125
|
|
|
@@ -126,7 +127,7 @@ Description-Content-Type: text/markdown
|
|
|
126
127
|
<td width="50%" align="center" valign="top">
|
|
127
128
|
<br/>
|
|
128
129
|
|
|
129
|
-
### 跨平台兼容
|
|
130
|
+
### 🌐 跨平台兼容
|
|
130
131
|
|
|
131
132
|
插件模块编写一次即可在所有平台使用,无需为不同平台重复开发
|
|
132
133
|
|
|
@@ -136,7 +137,7 @@ Description-Content-Type: text/markdown
|
|
|
136
137
|
<td width="50%" align="center" valign="top">
|
|
137
138
|
<br/>
|
|
138
139
|
|
|
139
|
-
### 模块化设计
|
|
140
|
+
### 🧩 模块化设计
|
|
140
141
|
|
|
141
142
|
灵活的插件系统,易于扩展和集成,支持热插拔模块管理
|
|
142
143
|
|
|
@@ -144,7 +145,7 @@ Description-Content-Type: text/markdown
|
|
|
144
145
|
<td width="50%" align="center" valign="top">
|
|
145
146
|
<br/>
|
|
146
147
|
|
|
147
|
-
### 热重载支持
|
|
148
|
+
### 🔄 热重载支持
|
|
148
149
|
|
|
149
150
|
开发时无需重启即可重新加载代码,大幅提升开发迭代效率
|
|
150
151
|
|
|
@@ -157,37 +158,25 @@ Description-Content-Type: text/markdown
|
|
|
157
158
|
### 支持的适配器
|
|
158
159
|
|
|
159
160
|
<div align="center">
|
|
160
|
-
|
|
161
|
-
<table>
|
|
162
|
-
<tr>
|
|
163
|
-
<td width="35%" valign="middle" align="center">
|
|
164
|
-
|
|
165
|
-
<img src=".github/assets/adapter-showcase.png" width="320" alt="支持的适配器" />
|
|
166
|
-
|
|
167
|
-
</td>
|
|
168
|
-
<td valign="middle">
|
|
161
|
+
<!-- <img src=".github/assets/adapter-showcase.png" width="520" alt="适配器展示" /> -->
|
|
169
162
|
|
|
170
163
|
欢迎您贡献适配器!
|
|
171
164
|
|
|
172
165
|
| 适配器 | 说明 |
|
|
173
166
|
|--------|------|
|
|
174
|
-
| [Kook](https://github.com/shanfishapp/ErisPulse-KookAdapter) | Kook(开黑啦)即时通讯平台 |
|
|
175
|
-
| [Matrix](https://github.com/ErisPulse/ErisPulse-MatrixAdapter) | Matrix 去中心化通讯协议 |
|
|
176
|
-
| [OneBot11](https://github.com/ErisPulse/ErisPulse-OneBot11Adapter) | OneBot v11 通用机器人协议 |
|
|
177
|
-
| [OneBot12](https://github.com/ErisPulse/ErisPulse-OneBot12Adapter) | OneBot v12 标准协议 |
|
|
178
|
-
| [QQ](https://github.com/ErisPulse/ErisPulse-QQBotAdapter) | QQ 官方机器人平台 |
|
|
179
|
-
| [沙箱](https://github.com/ErisPulse/ErisPulse-SandboxAdapter) | 网页端调试,无需接入真实平台 |
|
|
180
|
-
| [Telegram](https://github.com/ErisPulse/ErisPulse-TelegramAdapter) | 全球性即时通讯平台 |
|
|
181
|
-
| [邮件](https://github.com/ErisPulse/ErisPulse-EmailAdapter) | 邮件协议收发适配器 |
|
|
182
|
-
| [云湖](https://github.com/ErisPulse/ErisPulse-YunhuAdapter) | 企业级即时通讯平台(机器人接入) |
|
|
167
|
+
| <img src=".github/assets/adapter_logo/kook.svg" height="20" alt="Kook" /> [Kook](https://github.com/shanfishapp/ErisPulse-KookAdapter) | Kook(开黑啦)即时通讯平台 |
|
|
168
|
+
| <img src=".github/assets/adapter_logo/matrix.svg" height="20" alt="Matrix" /> [Matrix](https://github.com/ErisPulse/ErisPulse-MatrixAdapter) | Matrix 去中心化通讯协议 |
|
|
169
|
+
| <img src=".github/assets/adapter_logo/onebot.png" height="20" alt="OneBot" /> [OneBot11](https://github.com/ErisPulse/ErisPulse-OneBot11Adapter) | OneBot v11 通用机器人协议 |
|
|
170
|
+
| <img src=".github/assets/adapter_logo/onebot.png" height="20" alt="OneBot" /> [OneBot12](https://github.com/ErisPulse/ErisPulse-OneBot12Adapter) | OneBot v12 标准协议 |
|
|
171
|
+
| <img src=".github/assets/adapter_logo/qqbot.svg" height="20" alt="QQ" /> [QQ](https://github.com/ErisPulse/ErisPulse-QQBotAdapter) | QQ 官方机器人平台 |
|
|
172
|
+
| <img src=".github/assets/adapter_logo/sandbox.png" height="20" alt="Sandbox" /> [沙箱](https://github.com/ErisPulse/ErisPulse-SandboxAdapter) | 网页端调试,无需接入真实平台 |
|
|
173
|
+
| <img src=".github/assets/adapter_logo/telegram.svg" height="20" alt="Telegram" /> [Telegram](https://github.com/ErisPulse/ErisPulse-TelegramAdapter) | 全球性即时通讯平台 |
|
|
174
|
+
| <img src=".github/assets/adapter_logo/email.svg" height="20" alt="Email" /> [邮件](https://github.com/ErisPulse/ErisPulse-EmailAdapter) | 邮件协议收发适配器 |
|
|
175
|
+
| <img src=".github/assets/adapter_logo/yunhu.png" height="20" alt="Yunhu" /> [云湖](https://github.com/ErisPulse/ErisPulse-YunhuAdapter) | 企业级即时通讯平台(机器人接入) |
|
|
183
176
|
| [云湖用户](https://github.com/wsu2059q/ErisPulse-YunhuUserAdapter) | 基于云湖用户协议的接入适配器 |
|
|
184
177
|
| [花枫咖啡馆](https://github.com/ErisPulse/ErisPulse-Ideaura/) | Allons! \(・ω・) / |
|
|
185
178
|
|
|
186
|
-
查看 [
|
|
187
|
-
|
|
188
|
-
</td>
|
|
189
|
-
</tr>
|
|
190
|
-
</table>
|
|
179
|
+
查看 [适配器详情介绍](docs/zh-CN/platform-guide/README.md)
|
|
191
180
|
|
|
192
181
|
</div>
|
|
193
182
|
|
|
@@ -290,13 +279,21 @@ bash <(curl -sL https://get-1panel.erisdev.com/install.sh)
|
|
|
290
279
|
pip install ErisPulse
|
|
291
280
|
```
|
|
292
281
|
|
|
293
|
-
<img src=".github/assets/docs/install_pip.gif"
|
|
282
|
+
<img src=".github/assets/docs/install_pip.gif" alt="安装演示" />
|
|
294
283
|
|
|
295
284
|
> 如果您的 Python 版本低于 3.10,可以使用一键安装脚本自动配置环境。详见 [安装脚本说明](scripts/install/)。
|
|
296
285
|
|
|
297
286
|
#### 运行效果
|
|
298
287
|
|
|
299
|
-
|
|
288
|
+
|
|
289
|
+
##### 仪表盘:
|
|
290
|
+
> 有一个gif,但是太大了没放到这里~ 抱歉~
|
|
291
|
+
> [GIF演示](.github/assets/docs/dashboard-demo.gif)
|
|
292
|
+
|
|
293
|
+
<img src=".github/assets/docs/dashboard.png" alt="Dashboard 演示" />
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
##### 同一端代码,多个平台响应:
|
|
300
297
|
|
|
301
298
|
<table>
|
|
302
299
|
<tr>
|
|
@@ -409,19 +406,6 @@ epsdk run main.py --reload
|
|
|
409
406
|
|
|
410
407
|
---
|
|
411
408
|
|
|
412
|
-
### 文档与资源
|
|
413
|
-
|
|
414
|
-
| 简体中文 | English | 繁體中文 |
|
|
415
|
-
|:---:|:---:|:---:|
|
|
416
|
-
| [文档入口](docs/zh-CN/README.md) | [Documentation](docs/en/README.md) | [文檔入口](docs/zh-TW/README.md) |
|
|
417
|
-
|
|
418
|
-
| 平台 | 主站点 | 备用站点 |
|
|
419
|
-
|------|--------|---------|
|
|
420
|
-
| 文档 | [erisdev.com](https://www.erisdev.com/#docs) | [Cloudflare](https://erispulse.pages.dev/#docs) · [GitHub](https://erispulse.github.io/#docs) · [Netlify](https://erispulse.netlify.app/#docs) |
|
|
421
|
-
| 模块市场 | [erisdev.com](https://www.erisdev.com/#market) | [Cloudflare](https://erispulse.pages.dev/#market) · [GitHub](https://erispulse.github.io/#market) · [Netlify](https://erispulse.netlify.app/#market) |
|
|
422
|
-
|
|
423
|
-
---
|
|
424
|
-
|
|
425
409
|
### 贡献指南
|
|
426
410
|
|
|
427
411
|
ErisPulse 项目的健全性还需要您的一份力!我们欢迎各种形式的贡献:
|
|
@@ -435,6 +419,12 @@ ErisPulse 项目的健全性还需要您的一份力!我们欢迎各种形式
|
|
|
435
419
|
|
|
436
420
|
---
|
|
437
421
|
|
|
422
|
+
## Star History
|
|
423
|
+
|
|
424
|
+
[](https://star-history.com/#ErisPulse/ErisPulse&Date)
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
438
428
|
<div align="center">
|
|
439
429
|
|
|
440
430
|
### 致谢
|
|
@@ -17,17 +17,18 @@
|
|
|
17
17
|
|
|
18
18
|
> 支持 Vibe Coding 工作流,让 AI 直接生成可用模块 — [查看](docs/zh-CN/ai-support/README.md)
|
|
19
19
|
|
|
20
|
-
[](https://github.com/astral-sh/ruff)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
[](https://pypi.org/project/ErisPulse/)
|
|
21
|
+
[](https://pypi.org/project/ErisPulse/)
|
|
22
|
+
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
23
|
+
[](https://github.com/ErisPulse/ErisPulse/blob/main/LICENSE)
|
|
24
|
+
[](https://github.com/ErisPulse/ErisPulse)
|
|
25
|
+
[](https://pypi.org/project/ErisPulse/)
|
|
26
|
+
[](https://github.com/astral-sh/ruff)
|
|
27
|
+
[](https://socket.dev/pypi/package/erispulse)
|
|
28
|
+
|
|
29
|
+
[](https://www.erisdev.com)
|
|
30
|
+
[](https://www.erisdev.com/#market)
|
|
31
|
+
[](https://github.com/ErisPulse/ErisPulse/discussions)
|
|
31
32
|
|
|
32
33
|
</td>
|
|
33
34
|
</tr>
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
<td width="50%" align="center" valign="top">
|
|
47
48
|
<br/>
|
|
48
49
|
|
|
49
|
-
### 事件驱动架构
|
|
50
|
+
### ⚡ 事件驱动架构
|
|
50
51
|
|
|
51
52
|
基于 OneBot12 标准的清晰事件模型,让消息处理逻辑更加直观和高效
|
|
52
53
|
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
<td width="50%" align="center" valign="top">
|
|
55
56
|
<br/>
|
|
56
57
|
|
|
57
|
-
### 跨平台兼容
|
|
58
|
+
### 🌐 跨平台兼容
|
|
58
59
|
|
|
59
60
|
插件模块编写一次即可在所有平台使用,无需为不同平台重复开发
|
|
60
61
|
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
<td width="50%" align="center" valign="top">
|
|
65
66
|
<br/>
|
|
66
67
|
|
|
67
|
-
### 模块化设计
|
|
68
|
+
### 🧩 模块化设计
|
|
68
69
|
|
|
69
70
|
灵活的插件系统,易于扩展和集成,支持热插拔模块管理
|
|
70
71
|
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
<td width="50%" align="center" valign="top">
|
|
73
74
|
<br/>
|
|
74
75
|
|
|
75
|
-
### 热重载支持
|
|
76
|
+
### 🔄 热重载支持
|
|
76
77
|
|
|
77
78
|
开发时无需重启即可重新加载代码,大幅提升开发迭代效率
|
|
78
79
|
|
|
@@ -85,37 +86,25 @@
|
|
|
85
86
|
### 支持的适配器
|
|
86
87
|
|
|
87
88
|
<div align="center">
|
|
88
|
-
|
|
89
|
-
<table>
|
|
90
|
-
<tr>
|
|
91
|
-
<td width="35%" valign="middle" align="center">
|
|
92
|
-
|
|
93
|
-
<img src=".github/assets/adapter-showcase.png" width="320" alt="支持的适配器" />
|
|
94
|
-
|
|
95
|
-
</td>
|
|
96
|
-
<td valign="middle">
|
|
89
|
+
<!-- <img src=".github/assets/adapter-showcase.png" width="520" alt="适配器展示" /> -->
|
|
97
90
|
|
|
98
91
|
欢迎您贡献适配器!
|
|
99
92
|
|
|
100
93
|
| 适配器 | 说明 |
|
|
101
94
|
|--------|------|
|
|
102
|
-
| [Kook](https://github.com/shanfishapp/ErisPulse-KookAdapter) | Kook(开黑啦)即时通讯平台 |
|
|
103
|
-
| [Matrix](https://github.com/ErisPulse/ErisPulse-MatrixAdapter) | Matrix 去中心化通讯协议 |
|
|
104
|
-
| [OneBot11](https://github.com/ErisPulse/ErisPulse-OneBot11Adapter) | OneBot v11 通用机器人协议 |
|
|
105
|
-
| [OneBot12](https://github.com/ErisPulse/ErisPulse-OneBot12Adapter) | OneBot v12 标准协议 |
|
|
106
|
-
| [QQ](https://github.com/ErisPulse/ErisPulse-QQBotAdapter) | QQ 官方机器人平台 |
|
|
107
|
-
| [沙箱](https://github.com/ErisPulse/ErisPulse-SandboxAdapter) | 网页端调试,无需接入真实平台 |
|
|
108
|
-
| [Telegram](https://github.com/ErisPulse/ErisPulse-TelegramAdapter) | 全球性即时通讯平台 |
|
|
109
|
-
| [邮件](https://github.com/ErisPulse/ErisPulse-EmailAdapter) | 邮件协议收发适配器 |
|
|
110
|
-
| [云湖](https://github.com/ErisPulse/ErisPulse-YunhuAdapter) | 企业级即时通讯平台(机器人接入) |
|
|
95
|
+
| <img src=".github/assets/adapter_logo/kook.svg" height="20" alt="Kook" /> [Kook](https://github.com/shanfishapp/ErisPulse-KookAdapter) | Kook(开黑啦)即时通讯平台 |
|
|
96
|
+
| <img src=".github/assets/adapter_logo/matrix.svg" height="20" alt="Matrix" /> [Matrix](https://github.com/ErisPulse/ErisPulse-MatrixAdapter) | Matrix 去中心化通讯协议 |
|
|
97
|
+
| <img src=".github/assets/adapter_logo/onebot.png" height="20" alt="OneBot" /> [OneBot11](https://github.com/ErisPulse/ErisPulse-OneBot11Adapter) | OneBot v11 通用机器人协议 |
|
|
98
|
+
| <img src=".github/assets/adapter_logo/onebot.png" height="20" alt="OneBot" /> [OneBot12](https://github.com/ErisPulse/ErisPulse-OneBot12Adapter) | OneBot v12 标准协议 |
|
|
99
|
+
| <img src=".github/assets/adapter_logo/qqbot.svg" height="20" alt="QQ" /> [QQ](https://github.com/ErisPulse/ErisPulse-QQBotAdapter) | QQ 官方机器人平台 |
|
|
100
|
+
| <img src=".github/assets/adapter_logo/sandbox.png" height="20" alt="Sandbox" /> [沙箱](https://github.com/ErisPulse/ErisPulse-SandboxAdapter) | 网页端调试,无需接入真实平台 |
|
|
101
|
+
| <img src=".github/assets/adapter_logo/telegram.svg" height="20" alt="Telegram" /> [Telegram](https://github.com/ErisPulse/ErisPulse-TelegramAdapter) | 全球性即时通讯平台 |
|
|
102
|
+
| <img src=".github/assets/adapter_logo/email.svg" height="20" alt="Email" /> [邮件](https://github.com/ErisPulse/ErisPulse-EmailAdapter) | 邮件协议收发适配器 |
|
|
103
|
+
| <img src=".github/assets/adapter_logo/yunhu.png" height="20" alt="Yunhu" /> [云湖](https://github.com/ErisPulse/ErisPulse-YunhuAdapter) | 企业级即时通讯平台(机器人接入) |
|
|
111
104
|
| [云湖用户](https://github.com/wsu2059q/ErisPulse-YunhuUserAdapter) | 基于云湖用户协议的接入适配器 |
|
|
112
105
|
| [花枫咖啡馆](https://github.com/ErisPulse/ErisPulse-Ideaura/) | Allons! \(・ω・) / |
|
|
113
106
|
|
|
114
|
-
查看 [
|
|
115
|
-
|
|
116
|
-
</td>
|
|
117
|
-
</tr>
|
|
118
|
-
</table>
|
|
107
|
+
查看 [适配器详情介绍](docs/zh-CN/platform-guide/README.md)
|
|
119
108
|
|
|
120
109
|
</div>
|
|
121
110
|
|
|
@@ -218,13 +207,21 @@ bash <(curl -sL https://get-1panel.erisdev.com/install.sh)
|
|
|
218
207
|
pip install ErisPulse
|
|
219
208
|
```
|
|
220
209
|
|
|
221
|
-
<img src=".github/assets/docs/install_pip.gif"
|
|
210
|
+
<img src=".github/assets/docs/install_pip.gif" alt="安装演示" />
|
|
222
211
|
|
|
223
212
|
> 如果您的 Python 版本低于 3.10,可以使用一键安装脚本自动配置环境。详见 [安装脚本说明](scripts/install/)。
|
|
224
213
|
|
|
225
214
|
#### 运行效果
|
|
226
215
|
|
|
227
|
-
|
|
216
|
+
|
|
217
|
+
##### 仪表盘:
|
|
218
|
+
> 有一个gif,但是太大了没放到这里~ 抱歉~
|
|
219
|
+
> [GIF演示](.github/assets/docs/dashboard-demo.gif)
|
|
220
|
+
|
|
221
|
+
<img src=".github/assets/docs/dashboard.png" alt="Dashboard 演示" />
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
##### 同一端代码,多个平台响应:
|
|
228
225
|
|
|
229
226
|
<table>
|
|
230
227
|
<tr>
|
|
@@ -337,19 +334,6 @@ epsdk run main.py --reload
|
|
|
337
334
|
|
|
338
335
|
---
|
|
339
336
|
|
|
340
|
-
### 文档与资源
|
|
341
|
-
|
|
342
|
-
| 简体中文 | English | 繁體中文 |
|
|
343
|
-
|:---:|:---:|:---:|
|
|
344
|
-
| [文档入口](docs/zh-CN/README.md) | [Documentation](docs/en/README.md) | [文檔入口](docs/zh-TW/README.md) |
|
|
345
|
-
|
|
346
|
-
| 平台 | 主站点 | 备用站点 |
|
|
347
|
-
|------|--------|---------|
|
|
348
|
-
| 文档 | [erisdev.com](https://www.erisdev.com/#docs) | [Cloudflare](https://erispulse.pages.dev/#docs) · [GitHub](https://erispulse.github.io/#docs) · [Netlify](https://erispulse.netlify.app/#docs) |
|
|
349
|
-
| 模块市场 | [erisdev.com](https://www.erisdev.com/#market) | [Cloudflare](https://erispulse.pages.dev/#market) · [GitHub](https://erispulse.github.io/#market) · [Netlify](https://erispulse.netlify.app/#market) |
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
337
|
### 贡献指南
|
|
354
338
|
|
|
355
339
|
ErisPulse 项目的健全性还需要您的一份力!我们欢迎各种形式的贡献:
|
|
@@ -363,6 +347,12 @@ ErisPulse 项目的健全性还需要您的一份力!我们欢迎各种形式
|
|
|
363
347
|
|
|
364
348
|
---
|
|
365
349
|
|
|
350
|
+
## Star History
|
|
351
|
+
|
|
352
|
+
[](https://star-history.com/#ErisPulse/ErisPulse&Date)
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
366
356
|
<div align="center">
|
|
367
357
|
|
|
368
358
|
### 致谢
|
|
@@ -13,6 +13,13 @@ import asyncio
|
|
|
13
13
|
from abc import ABC, abstractmethod
|
|
14
14
|
from typing import Any
|
|
15
15
|
from collections.abc import Awaitable
|
|
16
|
+
from ..constants import (
|
|
17
|
+
RETCODE_NOT_IMPLEMENTED,
|
|
18
|
+
STATUS_FAILED,
|
|
19
|
+
DEFAULT_SEND_METHOD,
|
|
20
|
+
DEFAULT_SEND_TARGET_TYPE,
|
|
21
|
+
DETAIL_TYPE_PRIVATE,
|
|
22
|
+
)
|
|
16
23
|
|
|
17
24
|
|
|
18
25
|
class SendDSL:
|
|
@@ -209,8 +216,8 @@ class SendDSL:
|
|
|
209
216
|
|
|
210
217
|
async def _not_impl():
|
|
211
218
|
return {
|
|
212
|
-
"status":
|
|
213
|
-
"retcode":
|
|
219
|
+
"status": STATUS_FAILED,
|
|
220
|
+
"retcode": RETCODE_NOT_IMPLEMENTED,
|
|
214
221
|
"data": None,
|
|
215
222
|
"message_id": "",
|
|
216
223
|
"message": f"平台 {self._adapter.__class__.__name__} 未实现 Raw_ob12 方法",
|
|
@@ -254,10 +261,10 @@ class SendDSL:
|
|
|
254
261
|
if target_id is not None:
|
|
255
262
|
# 默认推断为 user(对应 private)
|
|
256
263
|
# 这里我们假设如果只提供 ID,通常是发送给用户
|
|
257
|
-
target_type =
|
|
264
|
+
target_type = DEFAULT_SEND_TARGET_TYPE
|
|
258
265
|
|
|
259
266
|
# 自动转换 private → user
|
|
260
|
-
if target_type ==
|
|
267
|
+
if target_type == DETAIL_TYPE_PRIVATE:
|
|
261
268
|
target_type = "user"
|
|
262
269
|
|
|
263
270
|
return self.__class__(self._adapter, target_type, target_id, self._account_id)
|
|
@@ -623,7 +630,7 @@ class BaseAdapter(ABC):
|
|
|
623
630
|
"""
|
|
624
631
|
|
|
625
632
|
async def _send_wrapper():
|
|
626
|
-
method_name = kwargs.pop("method",
|
|
633
|
+
method_name = kwargs.pop("method", DEFAULT_SEND_METHOD)
|
|
627
634
|
method = getattr(self.Send.To(target_type, target_id), method_name, None)
|
|
628
635
|
if not method:
|
|
629
636
|
raise AttributeError(
|
|
@@ -19,6 +19,7 @@ import asyncio
|
|
|
19
19
|
from abc import ABC, abstractmethod
|
|
20
20
|
from typing import Any
|
|
21
21
|
from collections.abc import Awaitable
|
|
22
|
+
from ..constants import RETCODE_NOT_IMPLEMENTED, STATUS_FAILED, DEFAULT_SEND_METHOD, DEFAULT_SEND_TARGET_TYPE, DETAIL_TYPE_PRIVATE
|
|
22
23
|
|
|
23
24
|
class SendDSL:
|
|
24
25
|
"""
|
|
@@ -7,6 +7,7 @@ ErisPulse 模块基础模块
|
|
|
7
7
|
from abc import ABC, abstractmethod
|
|
8
8
|
from typing import Any
|
|
9
9
|
from ...loaders.strategy import ModuleLoadStrategy
|
|
10
|
+
from ..constants import DEFAULT_LAZY_LOADING_ENABLED, DEFAULT_MODULE_PRIORITY
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class BaseModule(ABC):
|
|
@@ -51,8 +52,8 @@ class BaseModule(ABC):
|
|
|
51
52
|
{!--< /tips >!--}
|
|
52
53
|
"""
|
|
53
54
|
return ModuleLoadStrategy(
|
|
54
|
-
lazy_load=
|
|
55
|
-
priority=
|
|
55
|
+
lazy_load=DEFAULT_LAZY_LOADING_ENABLED,
|
|
56
|
+
priority=DEFAULT_MODULE_PRIORITY,
|
|
56
57
|
)
|
|
57
58
|
|
|
58
59
|
# @staticmethod
|
|
@@ -11,10 +11,13 @@ ErisPulse 事件处理基础模块
|
|
|
11
11
|
|
|
12
12
|
from .. import adapter, logger
|
|
13
13
|
from ...runtime import get_event_config
|
|
14
|
+
from ...runtime.context import current_owner
|
|
15
|
+
from ..constants import DEFAULT_HANDLER_PRIORITY, UNKNOWN_PLATFORM, EVENT_TYPE_MESSAGE, HANDLER_SLOW_THRESHOLD_SECS
|
|
14
16
|
from typing import Any
|
|
15
17
|
from collections.abc import Callable
|
|
16
18
|
import asyncio
|
|
17
19
|
import inspect
|
|
20
|
+
import time as _time
|
|
18
21
|
from itertools import groupby
|
|
19
22
|
from .wrapper import Event
|
|
20
23
|
from ..lifecycle import lifecycle
|
|
@@ -32,11 +35,16 @@ async def _invoke_handler(handler_info: dict, event: Event) -> None:
|
|
|
32
35
|
:param event: 事件对象
|
|
33
36
|
"""
|
|
34
37
|
handler = handler_info["func"]
|
|
38
|
+
_hname = getattr(handler, "__qualname__", getattr(handler, "__name__", str(handler)))
|
|
35
39
|
try:
|
|
40
|
+
_t = _time.monotonic()
|
|
36
41
|
if inspect.iscoroutinefunction(handler):
|
|
37
42
|
await handler(event)
|
|
38
43
|
else:
|
|
39
44
|
handler(event)
|
|
45
|
+
_elapsed = _time.monotonic() - _t
|
|
46
|
+
if _elapsed > HANDLER_SLOW_THRESHOLD_SECS:
|
|
47
|
+
logger.warning(f"[EventHandler] Slow handler {_hname} took {_elapsed:.4f}s")
|
|
40
48
|
except Exception as e:
|
|
41
49
|
logger.error(f"事件处理器执行错误: {e}")
|
|
42
50
|
|
|
@@ -71,7 +79,7 @@ class BaseEventHandler:
|
|
|
71
79
|
self._linked_to_adapter_bus: bool = False
|
|
72
80
|
|
|
73
81
|
def register(
|
|
74
|
-
self, handler: Callable, priority: int =
|
|
82
|
+
self, handler: Callable, priority: int = DEFAULT_HANDLER_PRIORITY, condition: Callable = None
|
|
75
83
|
):
|
|
76
84
|
"""
|
|
77
85
|
注册事件处理器
|
|
@@ -85,18 +93,17 @@ class BaseEventHandler:
|
|
|
85
93
|
"priority": priority,
|
|
86
94
|
"condition": condition,
|
|
87
95
|
"module": self.module_name,
|
|
96
|
+
"owner": current_owner.get(),
|
|
88
97
|
}
|
|
89
98
|
self.handlers.append(handler_info)
|
|
90
99
|
self._handler_map[id(handler)] = handler_info
|
|
91
|
-
# 按优先级排序(数值越大越先执行)
|
|
92
100
|
self.handlers.sort(key=lambda x: x["priority"], reverse=True)
|
|
93
101
|
|
|
94
|
-
# 注册到适配器
|
|
95
102
|
if self.event_type and not self._linked_to_adapter_bus:
|
|
96
103
|
adapter.on(self.event_type)(self._process_event)
|
|
97
104
|
self._linked_to_adapter_bus = True
|
|
98
105
|
logger.debug(
|
|
99
|
-
f"[Event] 已注册事件处理器: {self.event_type}, Called by: {self.module_name}"
|
|
106
|
+
f"[Event] 已注册事件处理器: {self.event_type}, Called by: {self.module_name}, Owner: {current_owner.get() or 'N/A'}"
|
|
100
107
|
)
|
|
101
108
|
|
|
102
109
|
def unregister(self, handler: Callable) -> bool:
|
|
@@ -113,7 +120,23 @@ class BaseEventHandler:
|
|
|
113
120
|
return True
|
|
114
121
|
return False
|
|
115
122
|
|
|
116
|
-
def
|
|
123
|
+
def unregister_by_owner(self, owner: str) -> int:
|
|
124
|
+
"""
|
|
125
|
+
{!--< internal-use >!--}
|
|
126
|
+
按归属者精确移除事件处理器
|
|
127
|
+
|
|
128
|
+
:param owner: 归属者(模块名)
|
|
129
|
+
:return: 移除的处理器数量
|
|
130
|
+
"""
|
|
131
|
+
before = len(self.handlers)
|
|
132
|
+
self.handlers = [h for h in self.handlers if h.get("owner") != owner]
|
|
133
|
+
self._handler_map = {id(h["func"]): h for h in self.handlers}
|
|
134
|
+
removed = before - len(self.handlers)
|
|
135
|
+
if removed > 0:
|
|
136
|
+
logger.debug(f"[Event] 已清理 {owner} 的 {removed} 个 {self.event_type} 处理器")
|
|
137
|
+
return removed
|
|
138
|
+
|
|
139
|
+
def __call__(self, priority: int = DEFAULT_HANDLER_PRIORITY, condition: Callable = None):
|
|
117
140
|
"""
|
|
118
141
|
装饰器方式注册事件处理器
|
|
119
142
|
|
|
@@ -144,12 +167,12 @@ class BaseEventHandler:
|
|
|
144
167
|
# 钩子: 事件预处理
|
|
145
168
|
await lifecycle.emit("event.pre_process", {
|
|
146
169
|
"event_type": self.event_type,
|
|
147
|
-
"platform": event.get("platform",
|
|
170
|
+
"platform": event.get("platform", UNKNOWN_PLATFORM),
|
|
148
171
|
"detail_type": event.get("detail_type", "unknown"),
|
|
149
172
|
})
|
|
150
173
|
|
|
151
174
|
# 忽略自己发送的消息
|
|
152
|
-
if self.event_type ==
|
|
175
|
+
if self.event_type == EVENT_TYPE_MESSAGE:
|
|
153
176
|
if event.get("self", {}).get("user_id") == event.get("user_id"):
|
|
154
177
|
event_config = get_event_config()
|
|
155
178
|
ignore_self = event_config.get("message", {}).get("ignore_self", True)
|
|
@@ -17,10 +17,13 @@ ErisPulse 事件处理基础模块
|
|
|
17
17
|
|
|
18
18
|
from .. import adapter, logger
|
|
19
19
|
from ...runtime import get_event_config
|
|
20
|
+
from ...runtime.context import current_owner
|
|
21
|
+
from ..constants import DEFAULT_HANDLER_PRIORITY, UNKNOWN_PLATFORM, EVENT_TYPE_MESSAGE, HANDLER_SLOW_THRESHOLD_SECS
|
|
20
22
|
from typing import Any
|
|
21
23
|
from collections.abc import Callable
|
|
22
24
|
import asyncio
|
|
23
25
|
import inspect
|
|
26
|
+
import time as _time
|
|
24
27
|
from itertools import groupby
|
|
25
28
|
from .wrapper import Event
|
|
26
29
|
from ..lifecycle import lifecycle
|