OneBotConnecter 0.3.2__tar.gz → 0.3.4__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.2
3
+ Version: 0.3.4
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.02"
7
+ version = "0.3.04"
8
8
  authors = [
9
9
  { name="Sugar51243", email="1733682365@qq.com" },
10
10
  ]
@@ -111,18 +111,18 @@ class OneBot:
111
111
  #报错处理,这里可能是来自post_type的Key_Exception
112
112
  # 所以打印处理,方便进一步人工识别和修改
113
113
  print(f"{message}\n")
114
- #处理 => 信息
115
- if self.testMode: print(f"待处理信息列表数量为: {len(self.message_list)}\n")
116
- #一口气清空缓存
117
- while len(self.message_list) > 0:
118
- try:
119
- message = self.message_list.pop(0)
120
- if self.testMode: print(f"{message}\n")
121
- await callback(self, message)
122
- except Exception as e:
123
- traceback.print_exc()
124
- print("")
125
- if self.testMode: print(f"信息列表处理完毕\n")
114
+ #处理 => 信息
115
+ if self.testMode: print(f"待处理信息列表数量为: {len(self.message_list)}\n")
116
+ #一口气清空缓存
117
+ while len(self.message_list) > 0:
118
+ try:
119
+ message = self.message_list.pop(0)
120
+ if self.testMode: print(f"{message}\n")
121
+ await callback(self, message)
122
+ except Exception as e:
123
+ traceback.print_exc()
124
+ print("")
125
+ if self.testMode: print(f"信息列表处理完毕\n")
126
126
  #连接失败
127
127
  except websockets.exceptions.ConnectionClosed:
128
128
  print("与机器人连接已断开\n")
@@ -151,7 +151,7 @@ class OneBot:
151
151
  await self.bot.send(datapack)
152
152
  #收集处理结果
153
153
  message = None
154
- get_message = False
154
+ self.get_message = False
155
155
  while True:
156
156
  #因为处理可能会有延迟,需要识别从接口收取的信息
157
157
  try:
@@ -178,8 +178,6 @@ class OneBot:
178
178
  if self.testMode:
179
179
  print("其他信息识别:")
180
180
  print(f"{message}\n")
181
- #继续收取
182
- await asyncio.sleep(1)
183
181
  #非常规信息 => 强行返回
184
182
  except:
185
183
  if self.testMode:
@@ -190,7 +188,9 @@ class OneBot:
190
188
  except RuntimeError: pass
191
189
  #处理失败
192
190
  except Exception as e: print(e)
193
- get_message = True
191
+ #继续收取
192
+ await asyncio.sleep(1)
193
+ self.get_message = True
194
194
  #识别完毕,返回
195
195
  if self.testMode: print(f"数据包返回: {message}\n")
196
196
  return message
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OneBotConnecter
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: 基于websocket(服务器正向)连接的onebot11通用python接口
5
5
  Author-email: Sugar51243 <1733682365@qq.com>
6
6
  License: MIT License
File without changes