跳至主要內容

liteyuki.bot.lifespan

远野千束小于 1 分钟API

def run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None

运行函数

Args:

funcs:

Returns:

class Lifespan

def __init__(self) -> None

 轻雪生命周期管理,启动、停止、重启

@staticmethod

def run_funcs(funcs: list[LIFESPAN_FUNC | PROCESS_LIFESPAN_FUNC]) -> None

 运行函数

Args:

funcs:

Returns:

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

 注册启动时的函数

Args:

func:

Returns:

LIFESPAN_FUNC:

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

 注册启动时的函数

Args:

func:

Returns:

LIFESPAN_FUNC:

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

 注册停止前的函数

Args:

func:

Returns:

LIFESPAN_FUNC:

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

 注册停止后的函数

Args:

func:

Returns:

LIFESPAN_FUNC:

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

 注册重启时的函数

Args:

func:

Returns:

LIFESPAN_FUNC:

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

 注册重启后的函数

Args:

func:

Returns:

LIFESPAN_FUNC:

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

 注册 NoneBot 初始化后的函数

Args:

func:

Returns:

def before_start(self) -> None

 启动前

Returns:

def after_start(self) -> None

 启动后

Returns:

def before_process_shutdown(self) -> None

 停止前

Returns:

def after_shutdown(self) -> None

 停止后

Returns:

def before_process_restart(self) -> None

 重启前

Returns:

def after_restart(self) -> None

 重启后

Returns:

var tasks = []

var loop = asyncio.get_event_loop()

var loop = asyncio.new_event_loop()