跳转至

backend.bot

bot

类:

名称 描述
KotoneBot

KotoneBot

方法:

名称 描述
__init__

初始化 KotoneBot。

initialize

初始化并载入所有任务和动作。

run

按优先级顺序运行所有任务。

start

在单独的线程中按优先级顺序运行指定的任务。

start_all

在单独的线程中运行所有任务。

__init__

__init__(module: str, config_path: str, config_type: type = dict[str, Any], *, debug: bool = False, resume_on_error: bool = False, auto_save_error_report: bool = False)

初始化 KotoneBot。

参数:

名称 类型 描述 默认
module
str

主模块名。此模块及其所有子模块都会被载入。

必需
config_type
type

配置类型。

dict[str, Any]
debug
bool

调试模式。

False
resume_on_error
bool

在错误时是否恢复。

False
auto_save_error_report
bool

是否自动保存错误报告。

False

initialize

initialize()

初始化并载入所有任务和动作。

run

run(tasks: list[Task], *, by_priority: bool = True)

按优先级顺序运行所有任务。

start

start(tasks: list[Task], *, by_priority: bool = True) -> RunStatus

在单独的线程中按优先级顺序运行指定的任务。

参数:

名称 类型 描述 默认
tasks
list[Task]

要运行的任务列表

必需
by_priority
bool

是否按优先级排序

True

返回:

类型 描述
RunStatus

运行状态对象

start_all

start_all() -> RunStatus

在单独的线程中运行所有任务。

返回:

类型 描述
RunStatus

运行状态对象