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.
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/PKG-INFO +1 -1
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/PKG-INFO +1 -1
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/OneBot.py +2 -2
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/__init__.py +1 -1
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/network.py +17 -11
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/LICENSE +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/SOURCES.txt +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/dependency_links.txt +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/requires.txt +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyper_bot.egg-info/top_level.txt +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/Milky.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/MilkyLib/Manager.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/MilkyLib/Res.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/MilkyLib/translator.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/OneBotLib/Manager.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/LecAdapters/OneBotLib/Res.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/__init__.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/builtins.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/common.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/listener.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/obuilder.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/adapters/res.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/common.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/configurator.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/events.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/hyperogger.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/listener.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/segments.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/service.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/ArkSignHelper.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/apiresponse.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/errors.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/hypetyping.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/logic.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/screens.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/hyperot/utils/typextensions.py +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/setup.cfg +0 -0
- {hyper_bot-0.82.2 → hyper_bot-0.82.3}/setup.py +0 -0
|
@@ -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
|
|
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}),退出")
|
|
@@ -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 =
|
|
23
|
-
self.ws =
|
|
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
|
|
29
|
+
self.ws = await wsc(self.url, header={"Authorization": "Bearer " + self.auth})
|
|
30
30
|
else:
|
|
31
|
-
self.ws
|
|
31
|
+
self.ws = await wsc(self.url)
|
|
32
32
|
|
|
33
33
|
async def send(self, message: str) -> None:
|
|
34
|
-
|
|
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
|
-
|
|
39
|
+
if self.ws is None:
|
|
40
|
+
raise RuntimeError("没有建立连接")
|
|
41
|
+
await self.ws.close()
|
|
38
42
|
|
|
39
43
|
async def recv(self) -> dict:
|
|
40
|
-
|
|
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 =
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|