mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 20:16:47 +00:00
✏️ add typing
This commit is contained in:
@ -29,11 +29,11 @@ class Adapter(abc.ABC):
|
||||
def config(self) -> Config:
|
||||
return self.driver.config
|
||||
|
||||
def bot_connect(self, bot: Bot):
|
||||
def bot_connect(self, bot: Bot) -> None:
|
||||
self.driver._bot_connect(bot)
|
||||
self.bots[bot.self_id] = bot
|
||||
|
||||
def bot_disconnect(self, bot: Bot):
|
||||
def bot_disconnect(self, bot: Bot) -> None:
|
||||
self.driver._bot_disconnect(bot)
|
||||
self.bots.pop(bot.self_id, None)
|
||||
|
||||
@ -58,7 +58,7 @@ class Adapter(abc.ABC):
|
||||
return await self.driver.websocket(setup)
|
||||
|
||||
@abc.abstractmethod
|
||||
async def _call_api(self, api: str, **data) -> Any:
|
||||
async def _call_api(self, bot: Bot, api: str, **data) -> Any:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
|
@ -100,7 +100,7 @@ class Bot(abc.ABC):
|
||||
|
||||
if not skip_calling_api:
|
||||
try:
|
||||
result = await self.adapter._call_api(api, **data)
|
||||
result = await self.adapter._call_api(self, api, **data)
|
||||
except Exception as e:
|
||||
exception = e
|
||||
|
||||
|
Reference in New Issue
Block a user