OneBotConnecter 0.3.19__tar.gz → 0.4.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OneBotConnecter
3
- Version: 0.3.19
3
+ Version: 0.4.1
4
4
  Summary: 基于websocket(服务器正向)连接的onebot11通用python接口
5
5
  Author-email: Sugar51243 <1733682365@qq.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "OneBotConnecter"
7
- version = "0.3.19"
7
+ version = "0.4.01"
8
8
  authors = [
9
9
  { name="Sugar51243", email="1733682365@qq.com" },
10
10
  ]
@@ -262,21 +262,43 @@ class PrivateCardMessage(Message):
262
262
  return [self.to_dict()]
263
263
 
264
264
  # 合并转发信息
265
- class PrivateCardMessage(Message):
265
+ class ForwardMessage(Message):
266
266
 
267
- data: Message
267
+ data: list[Message]
268
+
269
+ def __init__(self, data: list[Message] | Message, user_id: str, nickname: str = "某人"):
270
+ if not isinstance(data, list):
271
+ data = [data]
272
+ self.data = [{
273
+ "type": "node",
274
+ "user_id": user_id,
275
+ "nickname": nickname,
276
+ "data": {
277
+ "content": [msg.to_dict() for msg in data]
278
+ }
279
+ }]
280
+ self.user_id = user_id
281
+ self.nickname = nickname
268
282
 
269
- def __init__(self, data: Message):
270
- self.data = data
271
-
272
283
  def to_dict(self):
273
284
  msg = {
274
- "type": "json",
285
+ "type": "forward",
286
+ "messages": self.data
287
+ }
288
+ return msg
289
+
290
+ def addNode(self, data: list[Message] | Message, user_id: str, nickname: str = "某人"):
291
+ if not isinstance(data, list):
292
+ data = [data]
293
+ node = {
294
+ "type": "node",
295
+ "user_id": user_id,
296
+ "nickname": nickname,
275
297
  "data": {
276
- "content": self.data.returnData()
298
+ "content": [msg.to_dict() for msg in data]
277
299
  }
278
300
  }
279
- return msg
301
+ self.data.append(node)
280
302
 
281
303
  def returnData(self):
282
304
  return [self.to_dict()]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OneBotConnecter
3
- Version: 0.3.19
3
+ Version: 0.4.1
4
4
  Summary: 基于websocket(服务器正向)连接的onebot11通用python接口
5
5
  Author-email: Sugar51243 <1733682365@qq.com>
6
6
  License: MIT License