Skip to content
On this page

alicebot.config

AliceBot 配置。

AliceBot 使用 pydantic 来读取配置。

class ConfigModel

Bases: pydantic.main.BaseModel

AliceBot 配置模型。

  • Attributes

    • __config_name__ - 配置名称。

method __init__(__pydantic_self__, **data) {#BaseModel.__init__}

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

  • Arguments

    • data (Any)
  • Returns

    Type: None

class LogConfig

Bases: alicebot.config.ConfigModel

AliceBot 日志相关设置。

  • Attributes

    • level (Union[str, int]) - 日志级别。

    • verbose_exception (bool) - 详细的异常记录,设置为 True 时会在日志中添加异常的 Traceback。

method __init__(__pydantic_self__, **data) {#BaseModel.__init__}

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

  • Arguments

    • data (Any)
  • Returns

    Type: None

class BotConfig

Bases: alicebot.config.ConfigModel

Bot 配置。

  • Attributes

    • plugins (Set[str]) - 将被加载的插件列表,将被 Bot 类的 load_plugins() 方法加载。

    • plugin_dirs (Set[Annotated[pathlib.Path, PathType(path_type='dir')]]) - 将被加载的插件目录列表,将被 Bot 类的 load_plugins_from_dirs() 方法加载。

    • adapters (Set[str]) - 将被加载的适配器列表,将依次被 Bot 类的 load_adapters() 方法加载。

    • log (LogConfig) - AliceBot 日志相关设置。

method __init__(__pydantic_self__, **data) {#BaseModel.__init__}

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

  • Arguments

    • data (Any)
  • Returns

    Type: None

class PluginConfig

Bases: alicebot.config.ConfigModel

插件配置。

method __init__(__pydantic_self__, **data) {#BaseModel.__init__}

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

  • Arguments

    • data (Any)
  • Returns

    Type: None

class AdapterConfig

Bases: alicebot.config.ConfigModel

适配器配置。

method __init__(__pydantic_self__, **data) {#BaseModel.__init__}

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

  • Arguments

    • data (Any)
  • Returns

    Type: None

class MainConfig

Bases: alicebot.config.ConfigModel

AliceBot 配置。

  • Attributes

    • bot (BotConfig) - AliceBot 的主要配置。

    • plugin (PluginConfig)

    • adapter (AdapterConfig)

method __init__(__pydantic_self__, **data) {#BaseModel.__init__}

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

  • Arguments

    • data (Any)
  • Returns

    Type: None

Released under the MIT License.