Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions website/docs/tutorial/create-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ options:

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down Expand Up @@ -91,18 +93,20 @@ options:
$ nb plugin create
[?] 插件名称: weather
[?] 使用嵌套插件? (y/N) N
[?] 输出目录: awesome_bot/plugins
[?] 请输入插件存储位置: awesome_bot/plugins
```

`nb-cli` 会在 `awesome_bot/plugins` 目录下创建一个名为 `weather` 的文件夹,其中包含的文件将在稍后章节中用到。

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
| └── 📂 foo
| └── 📂 weather
| ├── 📜 __init__.py
| └── 📜 config.py
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down
16 changes: 12 additions & 4 deletions website/versioned_docs/version-2.4.2/tutorial/create-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ options:

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down Expand Up @@ -91,18 +93,20 @@ options:
$ nb plugin create
[?] 插件名称: weather
[?] 使用嵌套插件? (y/N) N
[?] 输出目录: awesome_bot/plugins
[?] 请输入插件存储位置: awesome_bot/plugins
```

`nb-cli` 会在 `awesome_bot/plugins` 目录下创建一个名为 `weather` 的文件夹,其中包含的文件将在稍后章节中用到。

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
| └── 📂 foo
| └── 📂 weather
| ├── 📜 __init__.py
| └── 📜 config.py
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down Expand Up @@ -189,12 +193,16 @@ nonebot.load_from_json("plugin_config.json", encoding="utf-8")

### `load_from_toml`

通过 TOML 文件加载插件,是 [`load_all_plugins`](#load_all_plugins) 的 TOML 变种。通过读取 TOML 文件中的 `[tool.nonebot]` Table 中的 `plugins` 和 `plugin_dirs` Array 进行加载。例如:
通过 TOML 文件加载插件,是 [`load_all_plugins`](#load_all_plugins) 的 TOML 变种。通过读取 TOML 文件中的 `[tool.nonebot]` Table 中的 `plugin_dirs` Array 与
`[tool.nonebot.plugins]` Table 中的多个 Array 进行加载。例如:

```toml title=plugin_config.toml
[tool.nonebot]
plugins = ["path.to.your.plugin"]
plugin_dirs = ["path/to/your/plugins"]

[tool.nonebot.plugins]
"@local" = ["path.to.your.plugin"] # 本地插件等非插件商店来源的插件
"nonebot-plugin-someplugin" = ["nonebot_plugin_someplugin"] # 插件商店来源的插件
```

```python
Expand Down
16 changes: 12 additions & 4 deletions website/versioned_docs/version-2.4.3/tutorial/create-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ options:

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down Expand Up @@ -91,18 +93,20 @@ options:
$ nb plugin create
[?] 插件名称: weather
[?] 使用嵌套插件? (y/N) N
[?] 输出目录: awesome_bot/plugins
[?] 请输入插件存储位置: awesome_bot/plugins
```

`nb-cli` 会在 `awesome_bot/plugins` 目录下创建一个名为 `weather` 的文件夹,其中包含的文件将在稍后章节中用到。

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
| └── 📂 foo
| └── 📂 weather
| ├── 📜 __init__.py
| └── 📜 config.py
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down Expand Up @@ -189,12 +193,16 @@ nonebot.load_from_json("plugin_config.json", encoding="utf-8")

### `load_from_toml`

通过 TOML 文件加载插件,是 [`load_all_plugins`](#load_all_plugins) 的 TOML 变种。通过读取 TOML 文件中的 `[tool.nonebot]` Table 中的 `plugins` 和 `plugin_dirs` Array 进行加载。例如:
通过 TOML 文件加载插件,是 [`load_all_plugins`](#load_all_plugins) 的 TOML 变种。通过读取 TOML 文件中的 `[tool.nonebot]` Table 中的 `plugin_dirs` Array 与
`[tool.nonebot.plugins]` Table 中的多个 Array 进行加载。例如:

```toml title=plugin_config.toml
[tool.nonebot]
plugins = ["path.to.your.plugin"]
plugin_dirs = ["path/to/your/plugins"]

[tool.nonebot.plugins]
"@local" = ["path.to.your.plugin"] # 本地插件等非插件商店来源的插件
"nonebot-plugin-someplugin" = ["nonebot_plugin_someplugin"] # 插件商店来源的插件
```

```python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ options:

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down Expand Up @@ -91,18 +93,20 @@ options:
$ nb plugin create
[?] 插件名称: weather
[?] 使用嵌套插件? (y/N) N
[?] 输出目录: awesome_bot/plugins
[?] 请输入插件存储位置: awesome_bot/plugins
```

`nb-cli` 会在 `awesome_bot/plugins` 目录下创建一个名为 `weather` 的文件夹,其中包含的文件将在稍后章节中用到。

```tree title=Project
📦 awesome-bot
├── 📂 .venv
├── 📂 awesome_bot
│ └── 📂 plugins
| └── 📂 foo
| └── 📂 weather
| ├── 📜 __init__.py
| └── 📜 config.py
├── 📜 .env.prod
├── 📜 pyproject.toml
└── 📜 README.md
```
Expand Down