app/docs/dev/api/bot/README.md
2024-08-19 09:55:47 +08:00

2.4 KiB
Raw Blame History

title index icon category
liteyuki.bot true laptop-code API

def get_bot() -> LiteyukiBot

获取轻雪实例

Returns:

LiteyukiBot: 当前的轻雪实例

def get_config(key: str, default: Any) -> Any

获取配置

Args:

key: 配置键

default: 默认值

Returns:

Any: 配置值

def get_config_with_compat(key: str, compat_keys: tuple[str], default: Any) -> Any

获取配置,兼容旧版本

Args:

key: 配置键

compat_keys: 兼容键

default: 默认值

Returns:

Any: 配置值

def print_logo() -> None

class LiteyukiBot

def run(self: Any) -> None

 启动逻辑

def keep_alive(self: Any) -> None

 保持轻雪运行

Returns:

def restart(self: Any, delay: int) -> None

 重启轻雪本体

Returns:

def restart_process(self: Any, name: Optional[str]) -> None

 停止轻雪

Args:

name: 进程名称, 默认为None, 所有进程

Returns:

def init(self: Any) -> None

 初始化轻雪, 自动调用

Returns:

def init_logger(self: Any) -> None

def stop(self: Any) -> None

 停止轻雪

Returns:

def on_before_start(self: Any, func: LIFESPAN_FUNC) -> None

 注册启动前的函数

Args:

func:

Returns:

def on_after_start(self: Any, func: LIFESPAN_FUNC) -> None

 注册启动后的函数

Args:

func:

Returns:

def on_after_shutdown(self: Any, func: LIFESPAN_FUNC) -> None

 注册停止后的函数:未实现

Args:

func:

Returns:

def on_before_process_shutdown(self: Any, func: LIFESPAN_FUNC) -> None

 注册进程停止前的函数,为子进程停止时调用

Args:

func:

Returns:

def on_before_process_restart(self: Any, func: LIFESPAN_FUNC) -> None

 注册进程重启前的函数,为子进程重启时调用

Args:

func:

Returns:

def on_after_restart(self: Any, func: LIFESPAN_FUNC) -> None

 注册重启后的函数:未实现

Args:

func:

Returns:

def on_after_nonebot_init(self: Any, func: LIFESPAN_FUNC) -> None

注册nonebot初始化后的函数

Args:

func:

Returns: