ErisPulse-Ideaura 0.1.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.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: ErisPulse-Ideaura
3
+ Version: 0.1.0
4
+ Summary: ErisPulse的Ideaura平台适配器
5
+ Author: ErisPulse
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 ErisPulse
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: homepage, https://github.com/ErisPulse/ErisPulse-Ideaura
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: aiohttp
33
+ Dynamic: license-file
34
+
35
+ # IdeauraAdapter 模块文档
36
+
37
+ ## 简介
38
+ IdeauraAdapter 是基于 [ErisPulse](https://github.com/ErisPulse/ErisPulse/) 架构的花枫咖啡馆(Allons)协议适配器,整合了所有平台功能模块,提供统一的事件处理和消息操作接口。
39
+
40
+ ## 使用示例
41
+
42
+ ### OneBot12标准事件类型
43
+
44
+ Ideaura适配器完全兼容 OneBot12 标准事件格式,并提供了一些扩展字段:
45
+
46
+ | 事件类型 | detail_type | 说明 |
47
+ |----------|-------------|------|
48
+ | 消息事件 | message | 标准消息事件 |
49
+ | 好友增加 | notice.friend_increase | 好友请求被接受 |
50
+ | 好友减少 | notice.friend_decrease | 好友关系被解除 |
51
+ | 消息编辑 | notice.ideaura_message_edit | 消息被编辑 |
52
+ | 消息撤回 | notice.ideaura_message_recall | 消息被撤回 |
53
+ | 消息转发 | notice.ideaura_message_forward | 消息被转发 |
54
+ | 消息已读 | notice.ideaura_message_read | 消息被标记已读 |
55
+ | 好友被拒 | notice.ideaura_friend_rejected | 好友请求被拒绝 |
56
+ | 好友上线 | notice.ideaura_friend_online | 好友上线 |
57
+ | 好友下线 | notice.ideaura_friend_offline | 好友下线 |
58
+ | 用户状态变更 | notice.ideaura_user_status_change | 用户状态变化 |
59
+ | 好友请求 | request.friend | 收到好友请求 |
60
+
61
+ ---
62
+
63
+ ## 消息发送示例
64
+
65
+ ```python
66
+ from ErisPulse.Core import adapter
67
+ ideaura = adapter.get("ideaura")
68
+
69
+ # 发送文本消息
70
+ await ideaura.Send.To("user", "user_id").Text("Hello World!")
71
+
72
+ # 发送带@的消息
73
+ await ideaura.Send.To("group", "chatroom").At("456").Text("@李四 你好")
74
+
75
+ # @多人
76
+ await ideaura.Send.To("group", "chatroom").At("456").At("789").Text("@多人")
77
+
78
+ # @全体
79
+ await ideaura.Send.To("group", "chatroom").AtAll().Text("通知所有人")
80
+
81
+ # 发送回复消息
82
+ await ideaura.Send.To("group", "chatroom").Reply("1001").Text("回复内容")
83
+
84
+ # 发送图片(从本地文件)
85
+ with open("photo.jpg", "rb") as f:
86
+ image_data = f.read()
87
+ await ideaura.Send.To("group", "chatroom").Image(image_data)
88
+
89
+ # 发送图片(从URL)
90
+ await ideaura.Send.To("group", "chatroom").Image("https://example.com/photo.jpg")
91
+
92
+ # 发送视频
93
+ await ideaura.Send.To("group", "chatroom").Video("https://example.com/video.mp4")
94
+
95
+ # 发送文件(带文件名)
96
+ with open("doc.pdf", "rb") as f:
97
+ file_data = f.read()
98
+ await ideaura.Send.To("group", "chatroom").File(file_data, "文档.pdf")
99
+
100
+ # 发送 Markdown 格式消息
101
+ await ideaura.Send.To("group", "chatroom").Markdown("# 标题\n- 列表项")
102
+
103
+ # 发送 HTML 格式消息
104
+ await ideaura.Send.To("group", "chatroom").Html("<b>加粗</b>消息")
105
+
106
+ # 编辑消息
107
+ await ideaura.Send.To("group", "chatroom").Edit("message_id", "修改后的内容")
108
+
109
+ # 撤回消息
110
+ await ideaura.Send.To("group", "chatroom").Recall("message_id")
111
+
112
+ # 使用 Raw_ob12 发送复杂消息
113
+ message = [
114
+ {"type": "text", "data": {"text": "第一行"}},
115
+ {"type": "image", "data": {"file": "http://example.com/img.jpg"}},
116
+ {"type": "text", "data": {"text": "第二行"}}
117
+ ]
118
+ await ideaura.Send.To("group", "chatroom").Raw_ob12(message)
119
+
120
+ # 组合使用
121
+ await ideaura.Send.To("group", "chatroom").Reply("1001").At("456").Text("回复并@")
122
+ ```
123
+
124
+ ---
125
+
126
+ ### 配置说明
127
+
128
+ 首次运行会生成配置。Ideaura适配器支持多账户配置。
129
+
130
+ #### 首次运行生成的默认配置
131
+
132
+ ```toml
133
+ [IdeauraAdapter.accounts.default]
134
+ email = "" # 登录邮箱(必填,请修改为实际邮箱)
135
+ password = "" # 登录密码(必填,请修改为实际密码)
136
+ enabled = false # 是否启用(填写完账号密码后改为true)
137
+ ```
138
+
139
+ #### 多账户配置示例
140
+
141
+ ```toml
142
+ # 账户1
143
+ [IdeauraAdapter.accounts.bot1]
144
+ email = "bot1@example.com"
145
+ password = "password1"
146
+ enabled = true
147
+
148
+ # 账户2
149
+ [IdeauraAdapter.accounts.bot2]
150
+ email = "bot2@example.com"
151
+ password = "password2"
152
+ enabled = true
153
+
154
+ # 可选:自定义服务器地址
155
+ [IdeauraAdapter]
156
+ base_url = "https://api-cofe.allons-y.uk:3009"
157
+ ws_url = "wss://api-cofe.allons-y.uk:3009/mqtt"
158
+ heartbeat_interval = 30
159
+ ```
160
+
161
+ **配置项说明:**
162
+ - `email`:账户登录邮箱(必填)
163
+ - `password`:账户登录密码(必填)
164
+ - `enabled`:是否启用该账户(可选,默认为true)
165
+
166
+ **全局配置项:**
167
+ - `base_url`:API 服务器地址(可选,默认为花枫咖啡馆官方地址)
168
+ - `ws_url`:WebSocket 服务器地址(可选,默认为花枫咖啡馆官方地址)
169
+ - `heartbeat_interval`:心跳间隔秒数(可选,默认30秒)
170
+
171
+ #### 指定发送账户
172
+
173
+ 可以通过 `Using()` 方法指定使用哪个账户发送消息:
174
+
175
+ ```python
176
+ from ErisPulse.Core import adapter
177
+ ideaura = adapter.get("ideaura")
178
+
179
+ # 使用账户名发送消息
180
+ await ideaura.Send.Using("bot1").To("user", "user123").Text("Hello from bot1!")
181
+
182
+ # 使用 user_id 发送消息(自动匹配对应账户)
183
+ await ideaura.Send.Using("456").To("group", "chatroom").Text("Hello from bot2!")
184
+
185
+ # 不指定时使用第一个启用的账户
186
+ await ideaura.Send.To("user", "user123").Text("Hello from default account!")
187
+ ```
188
+
189
+ ---
190
+
191
+ ## 平台特有功能
192
+
193
+ 请参考 [平台特性文档](platform-features.md) 了解花枫咖啡馆平台的特有功能,包括特有事件类型、扩展字段说明、消息编辑事件、消息转发事件、好友在线状态事件、用户状态变更事件等内容。
194
+
195
+ ## 事件监听示例
196
+
197
+ ### 使用 Event 模块(推荐)
198
+
199
+ ```python
200
+ from ErisPulse.Core.Event import message, notice
201
+
202
+ @message.on_message()
203
+ async def handle_message(event):
204
+ if event["platform"] == "ideaura":
205
+ detail_type = event.get("detail_type")
206
+ text = event.get_text()
207
+
208
+ if detail_type == "group":
209
+ source_type = event.get("ideaura_source_type")
210
+ if source_type == "topic":
211
+ topic_name = event.get("ideaura_topic_name")
212
+ elif detail_type == "private":
213
+ pass
214
+
215
+ @notice.on_notice()
216
+ async def handle_notice(event):
217
+ if event["platform"] == "ideaura":
218
+ detail_type = event.get("detail_type")
219
+
220
+ if detail_type == "ideaura_message_edit":
221
+ new_content = event.get("ideaura_new_content", "")
222
+
223
+ elif detail_type == "ideaura_message_recall":
224
+ message_id = event.get("message_id")
225
+
226
+ elif detail_type == "ideaura_friend_online":
227
+ friend_name = event.get_user_nickname()
228
+ ```
229
+
230
+ ### 使用 OneBot12 标准事件
231
+
232
+ ```python
233
+ from ErisPulse import sdk
234
+
235
+ @sdk.adapter.on("message")
236
+ async def handle_message(event):
237
+ if event["platform"] == "ideaura":
238
+ user_id = event["self"]["user_id"]
239
+ print(f"消息来自账户: {user_id}")
240
+
241
+ @sdk.adapter.on("notice")
242
+ async def handle_notice(event):
243
+ if event["platform"] == "ideaura":
244
+ pass
245
+
246
+ @sdk.adapter.on("request")
247
+ async def handle_request(event):
248
+ if event["platform"] == "ideaura":
249
+ if event.get("detail_type") == "friend":
250
+ user_nickname = event.get("user_nickname")
251
+ message = event.get("ideaura_message", "")
252
+ ```
253
+
254
+ ## 注意事项
255
+
256
+ 1. 确保在调用 `startup()` 前完成所有处理器的注册
257
+ 2. 适配器使用 WebSocket 长连接接收事件,支持自动重连(固定5秒延迟)
258
+ 3. 二进制内容(图片/视频等)支持 bytes、URL、本地路径三种输入方式
259
+ 4. 文件大小限制为 10MB
260
+ 5. 自身发送的消息(`isSelf: true`)会被自动过滤,不会产生事件
261
+ 6. @全体(`AtAll()`)需要管理员权限
262
+ 7. 程序退出时请调用 `shutdown()` 确保资源释放
263
+
264
+ ---
265
+
266
+ ### 参考链接
267
+
268
+ - [ErisPulse 主库](https://github.com/ErisPulse/ErisPulse/)
269
+ - [花枫咖啡馆官方API文档](APIDocs.md)
270
+ - [OneBot12协议对照](CoverToOnebot12.md)
271
+ - [模块开发指南](https://github.com/ErisPulse/ErisPulse/tree/main/docs/DEVELOPMENT.md)
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ ErisPulse_Ideaura.egg-info/PKG-INFO
5
+ ErisPulse_Ideaura.egg-info/SOURCES.txt
6
+ ErisPulse_Ideaura.egg-info/dependency_links.txt
7
+ ErisPulse_Ideaura.egg-info/entry_points.txt
8
+ ErisPulse_Ideaura.egg-info/requires.txt
9
+ ErisPulse_Ideaura.egg-info/top_level.txt
10
+ IdeauraAdapter/Converter.py
11
+ IdeauraAdapter/Core.py
12
+ IdeauraAdapter/__init__.py
13
+ test/test.py
@@ -0,0 +1,2 @@
1
+ [erispulse.adapter]
2
+ ideaura = IdeauraAdapter:IdeauraAdapter
@@ -0,0 +1 @@
1
+ IdeauraAdapter