mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 20:16:47 +00:00
⚗️ add ws connection hook
This commit is contained in:
@ -188,7 +188,7 @@ class Driver(BaseDriver):
|
||||
bot = BotClass(self, "websocket", self.config, x_self_id, websocket=ws)
|
||||
|
||||
await ws.accept()
|
||||
self._clients[x_self_id] = bot
|
||||
await self.bot_connect(bot)
|
||||
logger.opt(colors=True).info(
|
||||
f"WebSocket Connection from <y>{adapter.upper()} "
|
||||
f"Bot {x_self_id}</y> Accepted!")
|
||||
@ -202,7 +202,7 @@ class Driver(BaseDriver):
|
||||
|
||||
asyncio.create_task(bot.handle_message(data))
|
||||
finally:
|
||||
del self._clients[x_self_id]
|
||||
await self.bot_disconnect(bot)
|
||||
|
||||
|
||||
class WebSocket(BaseWebSocket):
|
||||
|
Reference in New Issue
Block a user