Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdayo committed May 6, 2023
1 parent 1409736 commit 381bf98
Show file tree
Hide file tree
Showing 7 changed files with 783 additions and 17 deletions.
5 changes: 0 additions & 5 deletions docs/.vitepress/theme/custom.css

This file was deleted.

1 change: 0 additions & 1 deletion docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DefaultTheme from 'vitepress/theme'
import './custom.css'

export default DefaultTheme
21 changes: 18 additions & 3 deletions docs/ecosystem/adapters/onebot.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ config.Bots.Add(new OneBotBotConfig
Endpoint = "ws://127.0.0.1:8080" // 配置的 WebSocket 监听地址
});

builder.AddAdapter(new OneBotAdapter(config));
builder.Adapters.Add(new OneBotAdapter(config));
```

如果你更倾向于使用独立的配置文件,你也可以这样做:
Expand All @@ -84,9 +84,24 @@ builder.AddAdapter(new OneBotAdapter(config));
```

```csharp
builder.AddAdapter(new OneBotAdapter(
builder.Adapters.Add(new OneBotAdapter(
builder.Configuration
.GetSection("Adapters:OneBot")
.Get<OneBotAdapterConfig>()
?? new OneBotAdapterConfig()));
```
```

## 扩展方法

我们也提供了几个扩展方法,稍微简化了一些:

首先安装 `Flandre.Adapters.OneBot.Extensions` NuGet 包,然后:

```csharp
// 从 Configuration 中的 Adapters:OneBot 读取配置项
builder.Adapters.AddOneBot();

builder.Adapters.AddOneBot(IConfiguration configuration);

builder.Adapters.AddOneBot(config => config.Xxx = /* ... */);
```
2 changes: 1 addition & 1 deletion docs/guide/command/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ExamplePlugin : Plugin
}
}

builder.AddPlugin<ExamplePlugin>();
builder.Plugins.Add<ExamplePlugin>();
```

Flandre 会自动解析指令方法的参数列表,在用户调用指令时,便会在解析成功后,将解析结果自动作为实参传入该方法。
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/start/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dotnet new flandre -o MyFirstFlandreApp
// 安装一个适配器,并添加在这里。
var config = new YourAdapterConfig();
// ...
builder.AddAdapter(new YourAdapter(config));
builder.Adapters.Add(new YourAdapter(config));
```

接下来,你将了解到和 Flandre 进行基础交互的知识。
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "flandre-docs",
"version": "1.0.0",
"description": "Documentation for the Flandre project",
"description": "Documentation for Project Flandre.",
"repository": "https://github.com/FlandreDevs/Docs.git",
"author": "b1acksoil <[email protected]>",
"author": "bsdayo <[email protected]>",
"private": true,
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:serve": "vitepress serve docs"
"dev": "vitepress dev docs --host",
"build": "vitepress build docs",
"serve": "vitepress serve docs"
},
"devDependencies": {
"vitepress": "^1.0.0-alpha.49",
"vitepress": "1.0.0-alpha.75",
"vue": "^3.2.47"
}
}
Loading

0 comments on commit 381bf98

Please sign in to comment.