🐛 fix hook block event receiving bug

This commit is contained in:
yanyongyu
2020-12-28 13:53:24 +08:00
parent c993f15bca
commit 299c259d50
3 changed files with 44 additions and 21 deletions

View File

@ -188,11 +188,12 @@ class Driver(BaseDriver):
bot = BotClass(self, "websocket", self.config, x_self_id, websocket=ws)
await ws.accept()
await self.bot_connect(bot)
logger.opt(colors=True).info(
f"WebSocket Connection from <y>{adapter.upper()} "
f"Bot {x_self_id}</y> Accepted!")
self.bot_connect(bot)
try:
while not ws.closed:
data = await ws.receive()
@ -202,7 +203,7 @@ class Driver(BaseDriver):
asyncio.create_task(bot.handle_message(data))
finally:
await self.bot_disconnect(bot)
self.bot_disconnect(bot)
class WebSocket(BaseWebSocket):