mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 09:38:21 +08:00
add driver type prop
This commit is contained in:
parent
c9d53bf017
commit
0eb5f51d2c
@ -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):
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user