mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-31 15:06:42 +00:00 
			
		
		
		
	🎨 add support for on_bot_* event handler
This commit is contained in:
		| @@ -121,6 +121,8 @@ class MiraiBot(BaseBot): | |||||||
|     def __init__(self, connection_type: str, self_id: str, *, |     def __init__(self, connection_type: str, self_id: str, *, | ||||||
|                  websocket: WebSocket): |                  websocket: WebSocket): | ||||||
|         super().__init__(connection_type, self_id, websocket=websocket) |         super().__init__(connection_type, self_id, websocket=websocket) | ||||||
|  |         websocket.handle(self.handle_message) | ||||||
|  |         self.driver._bot_connect(self) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     @overrides(BaseBot) |     @overrides(BaseBot) | ||||||
| @@ -213,3 +215,6 @@ class MiraiBot(BaseBot): | |||||||
|     @overrides(BaseBot) |     @overrides(BaseBot) | ||||||
|     async def send(self, event: "BaseEvent", message: str, **kwargs): |     async def send(self, event: "BaseEvent", message: str, **kwargs): | ||||||
|         return super().send(event, message, **kwargs) |         return super().send(event, message, **kwargs) | ||||||
|  |  | ||||||
|  |     def __del__(self): | ||||||
|  |         self.driver._bot_disconnect(self) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user