hyper-bot 1.0.1__tar.gz → 2.0.0__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.
Files changed (88) hide show
  1. hyper_bot-2.0.0/PKG-INFO +114 -0
  2. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/pyproject.toml +17 -2
  3. hyper_bot-2.0.0/readme.md +95 -0
  4. hyper_bot-2.0.0/src/hyper_bot.egg-info/PKG-INFO +114 -0
  5. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyper_bot.egg-info/SOURCES.txt +37 -0
  6. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyper_bot.egg-info/requires.txt +2 -0
  7. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/milky/translator.py +5 -5
  8. hyper_bot-2.0.0/src/hyperot/v2/__init__.py +75 -0
  9. hyper_bot-2.0.0/src/hyperot/v2/actions/__init__.py +103 -0
  10. hyper_bot-2.0.0/src/hyperot/v2/actions/base.py +23 -0
  11. hyper_bot-2.0.0/src/hyperot/v2/actions/formatting.py +98 -0
  12. hyper_bot-2.0.0/src/hyperot/v2/actions/models.py +343 -0
  13. hyper_bot-2.0.0/src/hyperot/v2/actions/result.py +175 -0
  14. hyper_bot-2.0.0/src/hyperot/v2/adapter/__init__.py +32 -0
  15. hyper_bot-2.0.0/src/hyperot/v2/adapter/loader.py +74 -0
  16. hyper_bot-2.0.0/src/hyperot/v2/adapter/manifest.py +24 -0
  17. hyper_bot-2.0.0/src/hyperot/v2/adapter/protocol.py +45 -0
  18. hyper_bot-2.0.0/src/hyperot/v2/adapter/registry.py +78 -0
  19. hyper_bot-2.0.0/src/hyperot/v2/api/__init__.py +27 -0
  20. hyper_bot-2.0.0/src/hyperot/v2/api/base.py +305 -0
  21. hyper_bot-2.0.0/src/hyperot/v2/api/context.py +12 -0
  22. hyper_bot-2.0.0/src/hyperot/v2/client/__init__.py +5 -0
  23. hyper_bot-2.0.0/src/hyperot/v2/client/client.py +181 -0
  24. hyper_bot-2.0.0/src/hyperot/v2/client/executor.py +46 -0
  25. hyper_bot-2.0.0/src/hyperot/v2/client/runtime.py +151 -0
  26. hyper_bot-2.0.0/src/hyperot/v2/common/__init__.py +60 -0
  27. hyper_bot-2.0.0/src/hyperot/v2/common/enums.py +24 -0
  28. hyper_bot-2.0.0/src/hyperot/v2/common/errors.py +53 -0
  29. hyper_bot-2.0.0/src/hyperot/v2/common/ids.py +11 -0
  30. hyper_bot-2.0.0/src/hyperot/v2/common/models.py +30 -0
  31. hyper_bot-2.0.0/src/hyperot/v2/config/__init__.py +19 -0
  32. hyper_bot-2.0.0/src/hyperot/v2/config/loader.py +64 -0
  33. hyper_bot-2.0.0/src/hyperot/v2/config/models.py +52 -0
  34. hyper_bot-2.0.0/src/hyperot/v2/events/__init__.py +52 -0
  35. hyper_bot-2.0.0/src/hyperot/v2/events/base.py +41 -0
  36. hyper_bot-2.0.0/src/hyperot/v2/events/dispatcher.py +61 -0
  37. hyper_bot-2.0.0/src/hyperot/v2/events/formatting.py +107 -0
  38. hyper_bot-2.0.0/src/hyperot/v2/events/models.py +260 -0
  39. hyper_bot-2.0.0/src/hyperot/v2/hyperogger.py +262 -0
  40. hyper_bot-2.0.0/src/hyperot/v2/logging.py +15 -0
  41. hyper_bot-2.0.0/src/hyperot/v2/messages/__init__.py +35 -0
  42. hyper_bot-2.0.0/src/hyperot/v2/messages/segments.py +188 -0
  43. hyper_bot-2.0.0/src/hyperot/v2/style.py +27 -0
  44. hyper_bot-1.0.1/PKG-INFO +0 -15
  45. hyper_bot-1.0.1/src/hyper_bot.egg-info/PKG-INFO +0 -15
  46. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/LICENSE +0 -0
  47. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/setup.cfg +0 -0
  48. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyper_bot.egg-info/dependency_links.txt +0 -0
  49. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyper_bot.egg-info/top_level.txt +0 -0
  50. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/__init__.py +0 -0
  51. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/__init__.py +0 -0
  52. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/milky/__init__.py +0 -0
  53. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/milky/actions.py +0 -0
  54. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/milky/listener.py +0 -0
  55. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/milky/packet.py +0 -0
  56. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/onebot/__init__.py +0 -0
  57. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/onebot/actions.py +0 -0
  58. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/onebot/listener.py +0 -0
  59. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/adapters/onebot/packet.py +0 -0
  60. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/common.py +0 -0
  61. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/configurator.py +0 -0
  62. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/events.py +0 -0
  63. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/hyperogger.py +0 -0
  64. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/listener.py +0 -0
  65. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/network.py +0 -0
  66. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/protocol/__init__.py +0 -0
  67. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/protocol/actions.py +0 -0
  68. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/protocol/builder.py +0 -0
  69. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/protocol/listener.py +0 -0
  70. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/protocol/segments.py +0 -0
  71. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/segments.py +0 -0
  72. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/__init__.py +0 -0
  73. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/apiresponse.py +0 -0
  74. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/ark_sign_helper.py +0 -0
  75. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/errors.py +0 -0
  76. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/hypetyping.py +0 -0
  77. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/screens.py +0 -0
  78. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/src/hyperot/utils/typextensions.py +0 -0
  79. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_configurator.py +0 -0
  80. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_events.py +0 -0
  81. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_listener.py +0 -0
  82. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_milky.py +0 -0
  83. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_network.py +0 -0
  84. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_onebot.py +0 -0
  85. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_registry.py +0 -0
  86. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_segments.py +0 -0
  87. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_utils.py +0 -0
  88. {hyper_bot-1.0.1 → hyper_bot-2.0.0}/tests/test_version.py +0 -0
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyper-bot
3
+ Version: 2.0.0
4
+ Summary: 稳定高效、易于开发的QQ Bot框架
5
+ Author-email: Harcic <harcic@outlook.com>
6
+ Project-URL: repository, https://github.com/HarcicYang/HyperBotCore
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: httpx~=0.28.1
11
+ Requires-Dist: websockets~=17.0.1
12
+ Requires-Dist: fastapi~=0.141.1
13
+ Requires-Dist: uvicorn~=0.52.0
14
+ Requires-Dist: ucfgr>=0.0.5
15
+ Requires-Dist: typing_extensions>=4.9
16
+ Requires-Dist: pydantic>=2.11
17
+ Requires-Dist: packaging>=24.0
18
+ Dynamic: license-file
19
+
20
+ ![banner](./ban.png)
21
+
22
+ <div align="center">
23
+ <h1>HypeR Core</h1>
24
+ </div>
25
+
26
+ <p align="center">基于 Python asyncio 的 QQ 机器人框架。V2 采用协议无关核心与独立适配器,V1 继续可用。</p>
27
+
28
+ <div align="center">
29
+ <img src="https://img.shields.io/badge/Python-3.11%2B-blue" alt="Python 3.11+">
30
+ <img src="https://img.shields.io/static/v1?label=LICENSE&message=GPL-3.0&color=lightrey" alt="GPL-3.0">
31
+ <img src="https://img.shields.io/pypi/v/hyper-bot?label=pypi&color=blue" alt="Pypi">
32
+ </div>
33
+
34
+ ## 概览
35
+
36
+ HypeR Core 是一个基于 Python asyncio 的 QQ 机器人框架,提供事件系统、消息构建和类型化 API。
37
+
38
+ V1 继续保留原有接口和内置协议支持。V2 使用独立的 `hyperot.v2` 命名空间,把框架核心和协议适配器分开维护:
39
+
40
+ - 框架本体只负责事件、消息、API 和生命周期。
41
+ - 具体协议通过独立适配器包接入。
42
+ - 不同适配器有自己的连接配置、事件映射和扩展能力。
43
+ - 业务代码优先使用协议无关的公共事件和 `client.api`。
44
+
45
+ ## V2
46
+
47
+ V2 使用一个 `Client` 管理一个适配器:
48
+
49
+ ```python
50
+ import asyncio
51
+
52
+ from hyperot.v2 import Client
53
+ from hyperot.v2.events import MessageReceivedEvent
54
+
55
+
56
+ async def on_message(event: MessageReceivedEvent, client: Client) -> None:
57
+ if str(event.message) == ".ping":
58
+ await client.api.scene(event.scene_type, event.scene_id).send("pong")
59
+
60
+
61
+ async def main() -> None:
62
+ client = Client.from_appconfig("appconfig.json")
63
+ client.subscribe(MessageReceivedEvent, on_message)
64
+ await client.run()
65
+
66
+
67
+ asyncio.run(main())
68
+ ```
69
+
70
+ 适配器单独安装。例如使用 OneBot v11:
71
+
72
+ ```shell
73
+ pip install hyper-bot hyperot-adapter-onebot
74
+ ```
75
+
76
+ 具体安装、连接配置和扩展能力见[适配器文档](./documents/adapters/index.md)。
77
+
78
+ ---
79
+
80
+ ## 文档
81
+
82
+ - [V2 文档](./documents/v2/index.md):配置、Client、事件、消息、API 和迁移。
83
+ - [适配器文档](./documents/adapters/index.md):各适配器的安装和使用说明。
84
+ - [V1 中文文档](./documents/zh.md):旧版接口和内置协议。
85
+
86
+ ## 安装
87
+
88
+ 需要 Python 3.11 或更高版本。
89
+
90
+ 框架本体:
91
+
92
+ ```shell
93
+ pip install hyper-bot
94
+ ```
95
+
96
+ 再安装一个适配器,例如:
97
+
98
+ ```shell
99
+ pip install hyperot-adapter-onebot
100
+ ```
101
+
102
+ ## 开发
103
+
104
+ 开发和构建使用 [uv](https://docs.astral.sh/uv/):
105
+
106
+ ```shell
107
+ git clone https://github.com/HarcicYang/HyperBotCore
108
+ cd HyperBotCore
109
+ uv sync
110
+ ```
111
+
112
+ ## 许可
113
+
114
+ GPL-3.0 License
@@ -4,12 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyper-bot"
7
- version = "1.0.1"
7
+ version = "2.0.0"
8
8
  description = "稳定高效、易于开发的QQ Bot框架"
9
+ readme = "readme.md"
9
10
  authors = [
10
11
  { name = "Harcic", email = "harcic@outlook.com" },
11
12
  ]
12
- urls = { repository = "https://github.com/HarcicYang/HypeR_Bot" }
13
+ urls = { repository = "https://github.com/HarcicYang/HyperBotCore" }
13
14
  requires-python = ">=3.11"
14
15
  dependencies = [
15
16
  "httpx~=0.28.1",
@@ -18,6 +19,8 @@ dependencies = [
18
19
  "uvicorn~=0.52.0",
19
20
  "ucfgr>=0.0.5",
20
21
  "typing_extensions>=4.9",
22
+ "pydantic>=2.11",
23
+ "packaging>=24.0",
21
24
  ]
22
25
 
23
26
  [tool.setuptools.packages.find]
@@ -38,7 +41,19 @@ dev = [
38
41
  "pytest>=9.1.1",
39
42
  "ruff>=0.16.1",
40
43
  "pyrefly>=1.2.0",
44
+ "hyperot-adapter-onebot",
41
45
  ]
42
46
 
43
47
  [tool.pytest.ini_options]
44
48
  testpaths = ["tests"]
49
+ markers = [
50
+ "euler_live: tests requiring a live local EulerOneBot account",
51
+ "euler_destructive: destructive live QQ operations",
52
+ ]
53
+
54
+ [tool.uv.workspace]
55
+ members = ["adapters/onebot"]
56
+
57
+ [tool.uv.sources]
58
+ hyper-bot = { workspace = true }
59
+ hyperot-adapter-onebot = { workspace = true }
@@ -0,0 +1,95 @@
1
+ ![banner](./ban.png)
2
+
3
+ <div align="center">
4
+ <h1>HypeR Core</h1>
5
+ </div>
6
+
7
+ <p align="center">基于 Python asyncio 的 QQ 机器人框架。V2 采用协议无关核心与独立适配器,V1 继续可用。</p>
8
+
9
+ <div align="center">
10
+ <img src="https://img.shields.io/badge/Python-3.11%2B-blue" alt="Python 3.11+">
11
+ <img src="https://img.shields.io/static/v1?label=LICENSE&message=GPL-3.0&color=lightrey" alt="GPL-3.0">
12
+ <img src="https://img.shields.io/pypi/v/hyper-bot?label=pypi&color=blue" alt="Pypi">
13
+ </div>
14
+
15
+ ## 概览
16
+
17
+ HypeR Core 是一个基于 Python asyncio 的 QQ 机器人框架,提供事件系统、消息构建和类型化 API。
18
+
19
+ V1 继续保留原有接口和内置协议支持。V2 使用独立的 `hyperot.v2` 命名空间,把框架核心和协议适配器分开维护:
20
+
21
+ - 框架本体只负责事件、消息、API 和生命周期。
22
+ - 具体协议通过独立适配器包接入。
23
+ - 不同适配器有自己的连接配置、事件映射和扩展能力。
24
+ - 业务代码优先使用协议无关的公共事件和 `client.api`。
25
+
26
+ ## V2
27
+
28
+ V2 使用一个 `Client` 管理一个适配器:
29
+
30
+ ```python
31
+ import asyncio
32
+
33
+ from hyperot.v2 import Client
34
+ from hyperot.v2.events import MessageReceivedEvent
35
+
36
+
37
+ async def on_message(event: MessageReceivedEvent, client: Client) -> None:
38
+ if str(event.message) == ".ping":
39
+ await client.api.scene(event.scene_type, event.scene_id).send("pong")
40
+
41
+
42
+ async def main() -> None:
43
+ client = Client.from_appconfig("appconfig.json")
44
+ client.subscribe(MessageReceivedEvent, on_message)
45
+ await client.run()
46
+
47
+
48
+ asyncio.run(main())
49
+ ```
50
+
51
+ 适配器单独安装。例如使用 OneBot v11:
52
+
53
+ ```shell
54
+ pip install hyper-bot hyperot-adapter-onebot
55
+ ```
56
+
57
+ 具体安装、连接配置和扩展能力见[适配器文档](./documents/adapters/index.md)。
58
+
59
+ ---
60
+
61
+ ## 文档
62
+
63
+ - [V2 文档](./documents/v2/index.md):配置、Client、事件、消息、API 和迁移。
64
+ - [适配器文档](./documents/adapters/index.md):各适配器的安装和使用说明。
65
+ - [V1 中文文档](./documents/zh.md):旧版接口和内置协议。
66
+
67
+ ## 安装
68
+
69
+ 需要 Python 3.11 或更高版本。
70
+
71
+ 框架本体:
72
+
73
+ ```shell
74
+ pip install hyper-bot
75
+ ```
76
+
77
+ 再安装一个适配器,例如:
78
+
79
+ ```shell
80
+ pip install hyperot-adapter-onebot
81
+ ```
82
+
83
+ ## 开发
84
+
85
+ 开发和构建使用 [uv](https://docs.astral.sh/uv/):
86
+
87
+ ```shell
88
+ git clone https://github.com/HarcicYang/HyperBotCore
89
+ cd HyperBotCore
90
+ uv sync
91
+ ```
92
+
93
+ ## 许可
94
+
95
+ GPL-3.0 License
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyper-bot
3
+ Version: 2.0.0
4
+ Summary: 稳定高效、易于开发的QQ Bot框架
5
+ Author-email: Harcic <harcic@outlook.com>
6
+ Project-URL: repository, https://github.com/HarcicYang/HyperBotCore
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: httpx~=0.28.1
11
+ Requires-Dist: websockets~=17.0.1
12
+ Requires-Dist: fastapi~=0.141.1
13
+ Requires-Dist: uvicorn~=0.52.0
14
+ Requires-Dist: ucfgr>=0.0.5
15
+ Requires-Dist: typing_extensions>=4.9
16
+ Requires-Dist: pydantic>=2.11
17
+ Requires-Dist: packaging>=24.0
18
+ Dynamic: license-file
19
+
20
+ ![banner](./ban.png)
21
+
22
+ <div align="center">
23
+ <h1>HypeR Core</h1>
24
+ </div>
25
+
26
+ <p align="center">基于 Python asyncio 的 QQ 机器人框架。V2 采用协议无关核心与独立适配器,V1 继续可用。</p>
27
+
28
+ <div align="center">
29
+ <img src="https://img.shields.io/badge/Python-3.11%2B-blue" alt="Python 3.11+">
30
+ <img src="https://img.shields.io/static/v1?label=LICENSE&message=GPL-3.0&color=lightrey" alt="GPL-3.0">
31
+ <img src="https://img.shields.io/pypi/v/hyper-bot?label=pypi&color=blue" alt="Pypi">
32
+ </div>
33
+
34
+ ## 概览
35
+
36
+ HypeR Core 是一个基于 Python asyncio 的 QQ 机器人框架,提供事件系统、消息构建和类型化 API。
37
+
38
+ V1 继续保留原有接口和内置协议支持。V2 使用独立的 `hyperot.v2` 命名空间,把框架核心和协议适配器分开维护:
39
+
40
+ - 框架本体只负责事件、消息、API 和生命周期。
41
+ - 具体协议通过独立适配器包接入。
42
+ - 不同适配器有自己的连接配置、事件映射和扩展能力。
43
+ - 业务代码优先使用协议无关的公共事件和 `client.api`。
44
+
45
+ ## V2
46
+
47
+ V2 使用一个 `Client` 管理一个适配器:
48
+
49
+ ```python
50
+ import asyncio
51
+
52
+ from hyperot.v2 import Client
53
+ from hyperot.v2.events import MessageReceivedEvent
54
+
55
+
56
+ async def on_message(event: MessageReceivedEvent, client: Client) -> None:
57
+ if str(event.message) == ".ping":
58
+ await client.api.scene(event.scene_type, event.scene_id).send("pong")
59
+
60
+
61
+ async def main() -> None:
62
+ client = Client.from_appconfig("appconfig.json")
63
+ client.subscribe(MessageReceivedEvent, on_message)
64
+ await client.run()
65
+
66
+
67
+ asyncio.run(main())
68
+ ```
69
+
70
+ 适配器单独安装。例如使用 OneBot v11:
71
+
72
+ ```shell
73
+ pip install hyper-bot hyperot-adapter-onebot
74
+ ```
75
+
76
+ 具体安装、连接配置和扩展能力见[适配器文档](./documents/adapters/index.md)。
77
+
78
+ ---
79
+
80
+ ## 文档
81
+
82
+ - [V2 文档](./documents/v2/index.md):配置、Client、事件、消息、API 和迁移。
83
+ - [适配器文档](./documents/adapters/index.md):各适配器的安装和使用说明。
84
+ - [V1 中文文档](./documents/zh.md):旧版接口和内置协议。
85
+
86
+ ## 安装
87
+
88
+ 需要 Python 3.11 或更高版本。
89
+
90
+ 框架本体:
91
+
92
+ ```shell
93
+ pip install hyper-bot
94
+ ```
95
+
96
+ 再安装一个适配器,例如:
97
+
98
+ ```shell
99
+ pip install hyperot-adapter-onebot
100
+ ```
101
+
102
+ ## 开发
103
+
104
+ 开发和构建使用 [uv](https://docs.astral.sh/uv/):
105
+
106
+ ```shell
107
+ git clone https://github.com/HarcicYang/HyperBotCore
108
+ cd HyperBotCore
109
+ uv sync
110
+ ```
111
+
112
+ ## 许可
113
+
114
+ GPL-3.0 License
@@ -1,5 +1,6 @@
1
1
  LICENSE
2
2
  pyproject.toml
3
+ readme.md
3
4
  src/hyper_bot.egg-info/PKG-INFO
4
5
  src/hyper_bot.egg-info/SOURCES.txt
5
6
  src/hyper_bot.egg-info/dependency_links.txt
@@ -35,6 +36,42 @@ src/hyperot/utils/errors.py
35
36
  src/hyperot/utils/hypetyping.py
36
37
  src/hyperot/utils/screens.py
37
38
  src/hyperot/utils/typextensions.py
39
+ src/hyperot/v2/__init__.py
40
+ src/hyperot/v2/hyperogger.py
41
+ src/hyperot/v2/logging.py
42
+ src/hyperot/v2/style.py
43
+ src/hyperot/v2/actions/__init__.py
44
+ src/hyperot/v2/actions/base.py
45
+ src/hyperot/v2/actions/formatting.py
46
+ src/hyperot/v2/actions/models.py
47
+ src/hyperot/v2/actions/result.py
48
+ src/hyperot/v2/adapter/__init__.py
49
+ src/hyperot/v2/adapter/loader.py
50
+ src/hyperot/v2/adapter/manifest.py
51
+ src/hyperot/v2/adapter/protocol.py
52
+ src/hyperot/v2/adapter/registry.py
53
+ src/hyperot/v2/api/__init__.py
54
+ src/hyperot/v2/api/base.py
55
+ src/hyperot/v2/api/context.py
56
+ src/hyperot/v2/client/__init__.py
57
+ src/hyperot/v2/client/client.py
58
+ src/hyperot/v2/client/executor.py
59
+ src/hyperot/v2/client/runtime.py
60
+ src/hyperot/v2/common/__init__.py
61
+ src/hyperot/v2/common/enums.py
62
+ src/hyperot/v2/common/errors.py
63
+ src/hyperot/v2/common/ids.py
64
+ src/hyperot/v2/common/models.py
65
+ src/hyperot/v2/config/__init__.py
66
+ src/hyperot/v2/config/loader.py
67
+ src/hyperot/v2/config/models.py
68
+ src/hyperot/v2/events/__init__.py
69
+ src/hyperot/v2/events/base.py
70
+ src/hyperot/v2/events/dispatcher.py
71
+ src/hyperot/v2/events/formatting.py
72
+ src/hyperot/v2/events/models.py
73
+ src/hyperot/v2/messages/__init__.py
74
+ src/hyperot/v2/messages/segments.py
38
75
  tests/test_configurator.py
39
76
  tests/test_events.py
40
77
  tests/test_listener.py
@@ -4,3 +4,5 @@ fastapi~=0.141.1
4
4
  uvicorn~=0.52.0
5
5
  ucfgr>=0.0.5
6
6
  typing_extensions>=4.9
7
+ pydantic>=2.11
8
+ packaging>=24.0
@@ -112,9 +112,9 @@ def message_translator(milky_message: list[dict], peer_id: int, scene: int = 0)
112
112
  case "xml":
113
113
  builder.json({"service_id": seg_data.get("service_id", 0), "payload": seg_data.get("xml_payload", "")})
114
114
  case "file":
115
- logger.debug(f"忽略不支持的文件消息段:{seg_data}")
115
+ logger.trace(f"忽略不支持的文件消息段:{seg_data}")
116
116
  case _:
117
- logger.debug(f"忽略未知消息段:{seg_type}")
117
+ logger.trace(f"忽略未知消息段:{seg_type}")
118
118
 
119
119
  return builder.build()
120
120
 
@@ -253,7 +253,7 @@ class MilkyHttpConnection(WebsocketConnection):
253
253
  .build()
254
254
  )
255
255
  if scene == "temp":
256
- logger.debug(f"临时会话消息按私聊消息处理:{milky_data}")
256
+ logger.trace(f"临时会话消息按私聊消息处理:{milky_data}")
257
257
  return (
258
258
  builder.init(milky_time, milky_self_id, milky_data["sender_id"], 0)
259
259
  .as_private_message(
@@ -263,7 +263,7 @@ class MilkyHttpConnection(WebsocketConnection):
263
263
  .private_sender("", "unknown", 0)
264
264
  .build()
265
265
  )
266
- logger.debug(f"忽略未知消息场景:{scene}")
266
+ logger.trace(f"忽略未知消息场景:{scene}")
267
267
  return None
268
268
  case "bot_offline":
269
269
  return (
@@ -407,7 +407,7 @@ class MilkyHttpConnection(WebsocketConnection):
407
407
  .build()
408
408
  )
409
409
  case _:
410
- logger.debug(f"忽略未知事件类型:{milky_event_type}")
410
+ logger.trace(f"忽略未知事件类型:{milky_event_type}")
411
411
  return None
412
412
 
413
413
  async def http_send(self, endpoint: str, data: dict) -> dict:
@@ -0,0 +1,75 @@
1
+ from .api import ClientAPI
2
+ from .client import Client
3
+ from .common import (
4
+ FileId,
5
+ GroupId,
6
+ MemberRole,
7
+ MessageId,
8
+ RequestId,
9
+ SceneId,
10
+ SceneType,
11
+ UserId,
12
+ )
13
+ from .events import (
14
+ BotOfflineEvent,
15
+ BotOnlineEvent,
16
+ ClientStartedEvent,
17
+ ClientStoppedEvent,
18
+ Event,
19
+ MessageReceivedEvent,
20
+ SceneEvent,
21
+ )
22
+ from .messages import (
23
+ Audio,
24
+ Face,
25
+ File,
26
+ Forward,
27
+ ForwardNode,
28
+ Image,
29
+ Markdown,
30
+ Mention,
31
+ MentionAll,
32
+ Message,
33
+ Quote,
34
+ Segment,
35
+ Text,
36
+ UnknownSegment,
37
+ Video,
38
+ )
39
+
40
+ __version__ = "2.0.0"
41
+
42
+ __all__ = [
43
+ "Audio",
44
+ "BotOfflineEvent",
45
+ "BotOnlineEvent",
46
+ "Client",
47
+ "ClientAPI",
48
+ "ClientStartedEvent",
49
+ "ClientStoppedEvent",
50
+ "Event",
51
+ "Face",
52
+ "File",
53
+ "FileId",
54
+ "Forward",
55
+ "ForwardNode",
56
+ "GroupId",
57
+ "Image",
58
+ "Markdown",
59
+ "MemberRole",
60
+ "Mention",
61
+ "MentionAll",
62
+ "Message",
63
+ "MessageId",
64
+ "MessageReceivedEvent",
65
+ "Quote",
66
+ "RequestId",
67
+ "SceneEvent",
68
+ "SceneId",
69
+ "SceneType",
70
+ "Segment",
71
+ "Text",
72
+ "UnknownSegment",
73
+ "UserId",
74
+ "Video",
75
+ ]
@@ -0,0 +1,103 @@
1
+ from .base import Action
2
+ from .models import (
3
+ ApproveFriendRequestAction,
4
+ ApproveGroupRequestAction,
5
+ DownloadFileAction,
6
+ FetchMessageAction,
7
+ GetBotProfileAction,
8
+ GetBotStatusAction,
9
+ GetCookieAction,
10
+ GetCsrfTokenAction,
11
+ GetFileInfoAction,
12
+ GetFriendListAction,
13
+ GetGroupListAction,
14
+ GetGroupMemberAction,
15
+ GetGroupMemberListAction,
16
+ GetGroupProfileAction,
17
+ GetUserProfileAction,
18
+ GetVersionAction,
19
+ KickMemberAction,
20
+ LeaveGroupAction,
21
+ MuteMemberAction,
22
+ PokeAction,
23
+ RawAction,
24
+ ReactMessageAction,
25
+ RecallMessageAction,
26
+ RejectFriendRequestAction,
27
+ RejectGroupRequestAction,
28
+ SendLikeAction,
29
+ SendMessageAction,
30
+ SetEssenceAction,
31
+ SetGroupMuteAction,
32
+ SetGroupNameAction,
33
+ SetMemberCardAction,
34
+ SetMemberRoleAction,
35
+ SetMemberTitleAction,
36
+ UnmuteMemberAction,
37
+ )
38
+ from .result import (
39
+ BotProfile,
40
+ BotStatus,
41
+ CookieInfo,
42
+ CsrfTokenInfo,
43
+ FileReference,
44
+ FileUrl,
45
+ FriendInfo,
46
+ GroupMemberProfile,
47
+ GroupProfile,
48
+ RawResult,
49
+ SendResult,
50
+ UserProfile,
51
+ VersionInfo,
52
+ )
53
+
54
+ __all__ = [
55
+ "Action",
56
+ "ApproveFriendRequestAction",
57
+ "ApproveGroupRequestAction",
58
+ "BotProfile",
59
+ "BotStatus",
60
+ "CookieInfo",
61
+ "CsrfTokenInfo",
62
+ "DownloadFileAction",
63
+ "FetchMessageAction",
64
+ "FileReference",
65
+ "FileUrl",
66
+ "FriendInfo",
67
+ "GetBotProfileAction",
68
+ "GetBotStatusAction",
69
+ "GetCookieAction",
70
+ "GetCsrfTokenAction",
71
+ "GetFileInfoAction",
72
+ "GetFriendListAction",
73
+ "GetGroupListAction",
74
+ "GetGroupMemberAction",
75
+ "GetGroupMemberListAction",
76
+ "GetGroupProfileAction",
77
+ "GetUserProfileAction",
78
+ "GetVersionAction",
79
+ "GroupMemberProfile",
80
+ "GroupProfile",
81
+ "KickMemberAction",
82
+ "LeaveGroupAction",
83
+ "MuteMemberAction",
84
+ "PokeAction",
85
+ "RawAction",
86
+ "RawResult",
87
+ "ReactMessageAction",
88
+ "RecallMessageAction",
89
+ "RejectFriendRequestAction",
90
+ "RejectGroupRequestAction",
91
+ "SendLikeAction",
92
+ "SendMessageAction",
93
+ "SendResult",
94
+ "SetEssenceAction",
95
+ "SetGroupMuteAction",
96
+ "SetGroupNameAction",
97
+ "SetMemberCardAction",
98
+ "SetMemberRoleAction",
99
+ "SetMemberTitleAction",
100
+ "UnmuteMemberAction",
101
+ "UserProfile",
102
+ "VersionInfo",
103
+ ]
@@ -0,0 +1,23 @@
1
+ from typing import ClassVar, Generic, TypeVar
2
+
3
+ from pydantic import BaseModel, ConfigDict
4
+
5
+ from .formatting import format_value
6
+
7
+ ResultT = TypeVar("ResultT")
8
+
9
+
10
+ class Action(BaseModel, Generic[ResultT]):
11
+ model_config = ConfigDict(frozen=True, extra="forbid", strict=True)
12
+
13
+ log_level: ClassVar[str] = "INFO"
14
+
15
+ def log_summary(self) -> str:
16
+ fields = [
17
+ f"{name}={format_value(value)}"
18
+ for name in type(self).model_fields
19
+ if (value := getattr(self, name)) is not None
20
+ ]
21
+ if not fields:
22
+ return type(self).__name__
23
+ return f"{type(self).__name__} {' '.join(fields)}"