Skip to content

Commit ea9774c

Browse files
committed
完善文档说明、迁移部分ob文档
1 parent b307a08 commit ea9774c

File tree

7 files changed

+1230
-5
lines changed

7 files changed

+1230
-5
lines changed

Writerside/s4.tree

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@
4343
<toc-element topic="official-components.md">
4444
<toc-element topic="component-qq-guild.md" />
4545
<toc-element topic="component-kook.md" />
46-
<toc-element topic="component-onebot.md"/>
46+
<toc-element topic="component-onebot.md">
47+
<toc-element toc-title="OneBot11">
48+
<toc-element topic="component-onebot-v11-start-using.md"/>
49+
<toc-element topic="component-onebot-v11-bot-config.md"/>
50+
</toc-element>
51+
</toc-element>
4752
<toc-element topic="component-telegram.md"/>
4853
<toc-element topic="component-discord.md"/>
4954
<toc-element topic="component-kritor.md"/>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Bot配置文件
2+
3+
Bot配置文件通常情况下是配合Spring Boot starter的时候用的。
4+
5+
当使用Spring Boot starter时,
6+
配置文件放在资源目录 <path>resources</path> 中的 <path>/simbot-bots/</path> 目录下,
7+
`.bot.json` 格式结尾,例如 `myBot.bot.json`
8+
9+
<warning title="记得清理注释">
10+
11+
实际上JSON配置文件是**不允许**使用注释的,这里只是方便展示。
12+
13+
</warning>
14+
15+
<tabs>
16+
<tab title="较完整示例">
17+
18+
```json
19+
{
20+
// 固定值
21+
"component": "simbot.onebot11",
22+
"authorization": {
23+
// 唯一ID,作为组件内 Bot 的 id,用于组件内去重。可以随便编,但建议是bot的qq号
24+
"botUniqueId": "123456",
25+
// api地址,是个http/https服务器的路径,默认localhost:3000
26+
"apiServerHost": "http://localhost:3000",
27+
// 订阅事件的服务器地址,是个ws/wss路径,默认 `null`
28+
// 如果为 `null` 则不会连接 ws 和订阅事件
29+
"eventServerHost": "ws://localhost:3001",
30+
// 配置的 token,可以是null, 代表同时配置 apiAccessToken 和 eventAccessToken
31+
"accessToken": null,
32+
// 用于API请求时用的 token,默认 null
33+
"apiAccessToken": null,
34+
// 用于连接事件订阅ws时用的 token,默认 null
35+
"eventAccessToken": null
36+
},
37+
// 额外的可选配置
38+
// config本身以及其内的各项属性绝大多数都可省略或null
39+
"config": {
40+
// API请求中的超时请求配置。整数数字,单位毫秒,默认为 `null`。
41+
"apiHttpRequestTimeoutMillis": null,
42+
// API请求中的超时请求配置。整数数字,单位毫秒,默认为 `null`。
43+
"apiHttpConnectTimeoutMillis": null,
44+
// API请求中的超时请求配置。整数数字,单位毫秒,默认为 `null`。
45+
"apiHttpSocketTimeoutMillis": null,
46+
// 每次尝试连接到 ws 服务时的最大重试次数,大于等于0的整数,默认为 2147483647
47+
"wsConnectMaxRetryTimes": null,
48+
// 每次尝试连接到 ws 服务时,如果需要重新尝试,则每次尝试之间的等待时长
49+
// 整数数字,单位毫秒,默认为 3500
50+
"wsConnectRetryDelayMillis": null,
51+
// 当使用非 [OneBotImage] 类型作为图片资源发送消息时,
52+
// 默认根据 [Resource] 得到一个可能存在的 [OneBotImage.AdditionalParams]。
53+
// 注意!这无法影响直接使用 [OneBotImage] 的情况。
54+
// defaultImageAdditionalParams 默认为 `null`。
55+
"defaultImageAdditionalParams": {
56+
// default: null
57+
"localFileToBase64": null,
58+
"type": null,
59+
"cache": null,
60+
"proxy": null,
61+
"timeout": null
62+
}
63+
}
64+
}
65+
```
66+
67+
</tab>
68+
<tab title="简单示例">
69+
70+
```json
71+
{
72+
"component": "simbot.onebot11",
73+
"authorization": {
74+
"botUniqueId": "123456",
75+
"apiServerHost": "http://localhost:3000",
76+
"eventServerHost":"ws://localhost:3001"
77+
}
78+
}
79+
```
80+
81+
</tab>
82+
</tabs>
83+
84+
## 属性说明
85+
86+
<warning>TODO</warning>

0 commit comments

Comments
 (0)