Tian-que / nonebot-adapter-kaiheila

Kaiheila adapter for nonebot2
MIT License
27 stars 9 forks source link

重连机制有问题 #41

Closed HOursH closed 9 months ago

HOursH commented 10 months ago

同时部署了基于dapters.qq和adapters.kaiheila机器人,在本地短暂断网又恢复后,qq机器人重连上了,但是kook的没有: 11-23 23:58:03 [ERROR] nonebot | Kaiheila | Error while setup websocket to wss://ws.kaiheila.cn/gateway?compress=0&token=打码==. Trying to reconnect... Traceback (most recent call last): File "C:\Users\666\Desktop\bot\bot.py", line 480, in nonebot.run() File "Z:\python\lib\site-packages\nonebot__init.py", line 331, in run get_driver().run(*args, *kwargs) File "Z:\python\lib\site-packages\nonebot\drivers\none.py", line 70, in run loop.run_until_complete(self._serve()) File "Z:\python\lib\asyncio\base_events.py", line 633, in run_until_complete self.run_forever() File "Z:\python\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "Z:\python\lib\asyncio\base_events.py", line 600, in run_forever self._run_once() File "Z:\python\lib\asyncio\base_events.py", line 1896, in _run_once handle._run() File "Z:\python\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "Z:\python\lib\site-packages\nonebot\adapters\kaiheila\adapter.py", line 212, in _forward_ws async with self.websocket(request) as ws: File "Z:\python\lib\contextlib.py", line 199, in aenter return await anext(self.gen) File "Z:\python\lib\site-packages\nonebot\internal\adapter\adapter.py", line 97, in websocket async with self.driver.websocket(setup) as ws: File "Z:\python\lib\contextlib.py", line 199, in aenter return await anext(self.gen) File "Z:\python\lib\site-packages\nonebot\drivers\websockets.py", line 77, in websocket async with connection as ws: File "Z:\python\lib\site-packages\websockets\legacy\client.py", line 642, in aenter return await self File "Z:\python\lib\site-packages\websockets\legacy\client.py", line 659, in await_impl_timeout return await asyncio.wait_for(self.await_impl(), self.open_timeout) File "Z:\python\lib\asyncio\tasks.py", line 408, in wait_for return await fut File "Z:\python\lib\site-packages\websockets\legacy\client.py", line 663, in await_impl__ _transport, _protocol = await self._create_connection() File "Z:\python\lib\asyncio\base_events.py", line 1025, in create_connection infos = await self._ensure_resolved( File "Z:\python\lib\asyncio\base_events.py", line 1404, in _ensure_resolved return await loop.getaddrinfo(host, port, family=family, type=type, File "Z:\python\lib\asyncio\base_events.py", line 860, in getaddrinfo return await self.run_in_executor( File "Z:\python\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "Z:\python\lib\socket.py", line 955, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11001] getaddrinfo failed

11-23 23:58:07 [ERROR] nonebot | Kaiheila | The current connection has expiredfor bot kook机器人代码. Trying to reconnect... Traceback (most recent call last): File "C:\Users\666\Desktop\bot\bot.py", line 480, in nonebot.run() File "Z:\python\lib\site-packages\nonebot__init__.py", line 331, in run get_driver().run(*args, *kwargs) File "Z:\python\lib\site-packages\nonebot\drivers\none.py", line 70, in run loop.run_until_complete(self._serve()) File "Z:\python\lib\asyncio\base_events.py", line 633, in run_until_complete self.run_forever() File "Z:\python\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "Z:\python\lib\asyncio\base_events.py", line 600, in run_forever self._run_once() File "Z:\python\lib\asyncio\base_events.py", line 1896, in _run_once handle._run() File "Z:\python\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "Z:\python\lib\site-packages\nonebot\adapters\kaiheila\adapter.py", line 223, in _forward_ws event = self.json_to_event(json_data, bot and bot.self_id) File "Z:\python\lib\site-packages\nonebot\adapters\kaiheila\adapter.py", line 316, in json_to_event raise ReconnectError nonebot.adapters.kaiheila.exception.ReconnectError: ReconnectError() 11-23 23:58:07 [INFO] nonebot | QQ | Bot 机器人代码 connected 11-23 23:58:07 [SUCCESS] nonebot | QQ 机器人代码 | [RESUMED]: {} 代码: nonebot.init()

driver = nonebot.get_driver() QQBot_driver = driver.register_adapter(QQAdapter) KookBot_driver = driver.register_adapter(KookAdapter) nonebot.run()