mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-03 02:24:51 +08:00
🎨 add support for on_bot_* event handler
This commit is contained in:
parent
8b3eb4e076
commit
5b3ef53301
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user