Skip to content

alicebot.dependencies

AliceBot 依赖注入。

实现依赖注入相关功能。

function Depends(dependency = None, *, use_cache = True)

子依赖装饰器。

  • Arguments

    • dependency (type[typing.Union[~_T, contextlib.AbstractAsyncContextManager[~_T], contextlib.AbstractContextManager[~_T]]] | collections.abc.Callable[[], collections.abc.AsyncGenerator[~_T, None]] | collections.abc.Callable[[], collections.abc.Generator[~_T, None, None]] | None) - 依赖类。如果不指定则根据字段的类型注释自动判断。

    • use_cache (bool) - 是否使用缓存。默认为 True

  • Returns

    Type: ~_T

    返回内部子依赖对象。

Released under the MIT License.