hyper-bot 0.82.2__tar.gz → 0.82.3__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 (38) hide show
  1. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/PKG-INFO +1 -1
  2. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/PKG-INFO +1 -1
  3. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/OneBot.py +2 -2
  4. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/__init__.py +1 -1
  5. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/network.py +17 -11
  6. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/LICENSE +0 -0
  7. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/SOURCES.txt +0 -0
  8. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/dependency_links.txt +0 -0
  9. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/requires.txt +0 -0
  10. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/top_level.txt +0 -0
  11. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/Milky.py +0 -0
  12. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/MilkyLib/Manager.py +0 -0
  13. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/MilkyLib/Res.py +0 -0
  14. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/MilkyLib/translator.py +0 -0
  15. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/OneBotLib/Manager.py +0 -0
  16. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/OneBotLib/Res.py +0 -0
  17. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/__init__.py +0 -0
  18. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/builtins.py +0 -0
  19. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/common.py +0 -0
  20. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/listener.py +0 -0
  21. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/obuilder.py +0 -0
  22. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/res.py +0 -0
  23. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/common.py +0 -0
  24. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/configurator.py +0 -0
  25. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/events.py +0 -0
  26. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/hyperogger.py +0 -0
  27. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/listener.py +0 -0
  28. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/segments.py +0 -0
  29. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/service.py +0 -0
  30. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/ArkSignHelper.py +0 -0
  31. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/apiresponse.py +0 -0
  32. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/errors.py +0 -0
  33. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/hypetyping.py +0 -0
  34. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/logic.py +0 -0
  35. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/screens.py +0 -0
  36. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/typextensions.py +0 -0
  37. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/setup.cfg +0 -0
  38. {hyper_bot-0.82.2 → hyper_bot-0.82.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper-bot
3
- Version: 0.82.2
3
+ Version: 0.82.3
4
4
  Summary: 稳定高效、易于开发的QQ Bot框架
5
5
  Home-page: https://github.com/HarcicYang/HypeR_Bot
6
6
  Author: Harcic
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper-bot
3
- Version: 0.82.2
3
+ Version: 0.82.3
4
4
  Summary: 稳定高效、易于开发的QQ Bot框架
5
5
  Home-page: https://github.com/HarcicYang/HypeR_Bot
6
6
  Author: Harcic
@@ -282,9 +282,9 @@ async def run() -> NoReturn:
282
282
  if config.connection.ob_auto_startup:
283
283
  LagrangeOneBotService(IServiceStartUp.MANUAL).run_in_thread(config)
284
284
 
285
- while True:
285
+ while 1:
286
286
  try:
287
- connection.connect()
287
+ await connection.connect()
288
288
  except (ConnectionRefusedError, TimeoutError):
289
289
  if retried >= config.connection.retries:
290
290
  logger.critical(f"重试次数达到最大值({config.connection.retries}),退出")
@@ -7,7 +7,7 @@ import sys
7
7
  import os
8
8
  import signal
9
9
 
10
- HYPER_BOT_VERSION = "0.82.2"
10
+ HYPER_BOT_VERSION = "0.82.3"
11
11
 
12
12
  # listener = None
13
13
 
@@ -1,5 +1,3 @@
1
- import asyncio
2
- import websocket
3
1
  import httpx
4
2
  import queue
5
3
  import flask
@@ -7,6 +5,8 @@ import traceback
7
5
  import json
8
6
  import logging
9
7
  import threading
8
+ from websockets.asyncio.client import connect as wsc
9
+ from websockets.asyncio.client import ClientConnection
10
10
 
11
11
 
12
12
  async def httpx_get(url: str, headers: dict = None) -> httpx.Response:
@@ -19,29 +19,35 @@ async def httpx_post(url: str, json: dict, headers: dict = None) -> httpx.Respon
19
19
 
20
20
 
21
21
  class WebsocketConnection:
22
- def __init__(self, url: str, auth: str = None):
23
- self.ws = websocket.WebSocket()
22
+ def __init__(self, url: str, auth: str = ""):
23
+ self.ws: ClientConnection = None
24
24
  self.url = url
25
25
  self.auth = auth
26
26
 
27
- def connect(self) -> None:
27
+ async def connect(self) -> None:
28
28
  if self.auth:
29
- self.ws.connect(self.url, header={"Authorization": "Bearer " + self.auth})
29
+ self.ws = await wsc(self.url, header={"Authorization": "Bearer " + self.auth})
30
30
  else:
31
- self.ws.connect(self.url)
31
+ self.ws = await wsc(self.url)
32
32
 
33
33
  async def send(self, message: str) -> None:
34
- await asyncio.to_thread(lambda: self.ws.send(message))
34
+ if self.ws is None:
35
+ raise RuntimeError("没有建立连接")
36
+ await self.ws.send(message)
35
37
 
36
38
  async def close(self) -> None:
37
- await asyncio.to_thread(lambda: self.ws.close())
39
+ if self.ws is None:
40
+ raise RuntimeError("没有建立连接")
41
+ await self.ws.close()
38
42
 
39
43
  async def recv(self) -> dict:
40
- return json.loads(await asyncio.to_thread(self.ws.recv))
44
+ if self.ws is None:
45
+ raise RuntimeError("没有建立连接")
46
+ return json.loads(await self.ws.recv())
41
47
 
42
48
 
43
49
  class HTTPConnection:
44
- def __init__(self, url: str, listener_url: str, listener_endpoint: str = "/", auth: str = None):
50
+ def __init__(self, url: str, listener_url: str, listener_endpoint: str = "/", auth: str = ""):
45
51
  self.url = url
46
52
  listener_url = listener_url.replace("http://", "")
47
53
  listener_url = listener_url.replace("https://", "")
File without changes
File without changes
File without changes
File without changes
File without changes