add driver type prop

This commit is contained in:
yanyongyu 2020-08-13 15:56:09 +08:00
parent c9d53bf017
commit 0eb5f51d2c
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,11 @@ class BaseDriver(abc.ABC):
def register_adapter(cls, name: str, adapter: Type[Bot]):
cls._adapters[name] = adapter
@property
@abc.abstractmethod
def type(self):
raise NotImplementedError
@property
@abc.abstractmethod
def server_app(self):

View File

@ -36,6 +36,11 @@ class Driver(BaseDriver):
self._server_app.websocket("/{adapter}/ws")(self._handle_ws_reverse)
self._server_app.websocket("/{adapter}/ws/")(self._handle_ws_reverse)
@property
@overrides(BaseDriver)
def type(self) -> str:
return "fastapi"
@property
@overrides(BaseDriver)
def server_app(self) -> FastAPI: