ErisPulse-OneBot11Adapter 3.3.0__tar.gz → 3.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse-OneBot11Adapter
3
- Version: 3.3.0
3
+ Version: 3.4.0
4
4
  Summary: ErisPulse的OneBotV11协议适配模块,异步的OneBot触发器
5
5
  Author-email: wsu2059q <wsu2059@qq.com>
6
6
  License: MIT License
@@ -29,6 +29,7 @@ class OneBot11Converter:
29
29
  "notify": "notify"
30
30
  }
31
31
 
32
+ # OneBotAdapter/Converter.py
32
33
  def convert(self, raw_event: Dict) -> Optional[Dict]:
33
34
  """
34
35
  将OneBot11事件转换为OneBot12格式
@@ -52,7 +53,8 @@ class OneBot11Converter:
52
53
  "platform": "onebot11",
53
54
  "user_id": str(raw_event.get("self_id", ""))
54
55
  },
55
- "onebot11_raw": raw_event # 保留原始数据
56
+ "onebot11_raw": raw_event, # 保留原始数据
57
+ "onebot11_raw_type": post_type # 原始事件类型字段
56
58
  }
57
59
 
58
60
  # 根据事件类型分发处理
@@ -3,7 +3,7 @@ import asyncio
3
3
  import json
4
4
  import aiohttp
5
5
  from fastapi import WebSocket, WebSocketDisconnect
6
- from typing import Dict, List, Optional, Any, Union
6
+ from typing import Dict, List, Optional, Union
7
7
  from ErisPulse import sdk
8
8
  from ErisPulse.Core import router
9
9
 
@@ -125,7 +125,7 @@ class OneBotAdapter(sdk.BaseAdapter):
125
125
  finally:
126
126
  try:
127
127
  os.remove(filepath)
128
- except:
128
+ except Exception:
129
129
  pass
130
130
  def Raw(self, message_list: List[Dict]):
131
131
  """
@@ -348,7 +348,6 @@ class OneBotAdapter(sdk.BaseAdapter):
348
348
  await asyncio.sleep(retry_interval)
349
349
 
350
350
  async def _listen(self):
351
- """监听WebSocket消息"""
352
351
  try:
353
352
  self.logger.debug("开始监听WebSocket消息")
354
353
  async for msg in self.connection:
@@ -391,12 +390,8 @@ class OneBotAdapter(sdk.BaseAdapter):
391
390
  self.logger.debug(f"识别为API响应消息: {data.get('echo')}")
392
391
  await self._handle_api_response(data)
393
392
  return
394
-
395
- post_type = data.get("post_type")
396
-
397
- await self.emit(post_type, data)
398
393
 
399
- self.logger.debug(f"处理OneBotV11事件: {post_type}")
394
+ self.logger.debug(f"处理OneBotV11事件: {data.get('post_type')}")
400
395
 
401
396
  # 转换为OneBot12事件并提交
402
397
  if hasattr(self.adapter, "emit"):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse-OneBot11Adapter
3
- Version: 3.3.0
3
+ Version: 3.4.0
4
4
  Summary: ErisPulse的OneBotV11协议适配模块,异步的OneBot触发器
5
5
  Author-email: wsu2059q <wsu2059@qq.com>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ErisPulse-OneBot11Adapter"
3
- version = "3.3.0"
3
+ version = "3.4.0"
4
4
  description = "ErisPulse的OneBotV11协议适配模块,异步的OneBot触发器"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"