✏️ add typing

This commit is contained in:
yanyongyu
2021-12-21 18:22:14 +08:00
parent b900133ab4
commit 9b2fa46921
8 changed files with 35 additions and 29 deletions

View File

@ -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:
"""
:说明:

View File

@ -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