import{_ as i,c as a,o as n,al as t}from"./chunks/framework.BUxnStXl.js";const E=JSON.parse('{"title":"配置","description":"","frontmatter":{"title":"配置","order":2},"headers":[],"relativePath":"deploy/config.md","filePath":"zh/deploy/config.md","lastUpdated":1734116271000}'),l={name:"deploy/config.md"};function h(e,s,k,p,d,o){return n(),a("div",null,s[0]||(s[0]=[t(`<h1 id="配置" tabindex="-1">配置 <a class="header-anchor" href="#配置" aria-label="Permalink to &quot;配置&quot;">​</a></h1><p>轻雪支持<code>yaml</code>、<code>json</code>和<code>toml</code>作为配置文件，取决于你个人的喜好</p><p>首次运行后生成<code>config.yml</code>和<code>config</code>目录，你可修改配置项后重启轻雪，绝大多数情况下，你只需要修改<code>superusers</code>及<code>nickname</code>字段即可</p><p>启动时会加载项目目录下<code>config.yml/yaml/json/toml</code>和<code>config</code>目录下的所有配置文件，你可在<code>config</code>目录下创建多个配置文件，轻雪会自动合并这些配置文件</p><h2 id="基础配置项" tabindex="-1"><strong>基础配置项</strong> <a class="header-anchor" href="#基础配置项" aria-label="Permalink to &quot;**基础配置项**&quot;">​</a></h2><div class="language-yaml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">nonebot</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">  # Nonebot机器人的配置，6.3.10版本后，NoneBot下配置已迁移至nonebot键下，不再使用外层配置，但是部分内容会被覆盖，请尽快迁移</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  command_start</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [ </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;/&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 指令前缀，若没有&quot;&quot;空命令头，请开启alconna_use_command_start保证alconna解析正常</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  host</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">127.0.0.1</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 监听地址，默认为本机，若要接收外部请求请填写0.0.0.0</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  port</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">20216</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 绑定端口</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  nickname</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [ </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;liteyuki&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]  </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 机器人昵称列表</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  superusers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [ </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;1919810&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]  </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 超级用户列表</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">liteyuki</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">  # 写在外层的配置项将会被覆盖，建议迁移到liteyuki下</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  log_level</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;INFO&quot;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 日志等级</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  log_icon</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 是否显示日志等级图标（某些控制台字体不可用）</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  auto_report</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 是否自动上报问题给轻雪服务器</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  auto_update</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 是否自动更新轻雪，每天4点检查更新</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  plugins</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [ ] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 轻雪插件列表</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  plugin_dirs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [ ] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 轻雪插件目录列表</span></span></code></pre></div><h2 id="其他配置" tabindex="-1"><strong>其他配置</strong> <a class="header-anchor" href="#其他配置" aria-label="Permalink to &quot;**其他配置**&quot;">​</a></h2><p>以下为默认值，如需自定义请手动添加</p><div class="language-yaml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 高级NoneBot配置</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">nonebot</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  onebot_access_token</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 访问令牌，对公开放时建议设置</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  default_language</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;zh-CN&quot;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 默认语言</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  alconna_auto_completion</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # alconna是否自动补全指令，默认false，建议开启</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  safe_mode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 安全模式，开启后将不会加载任何第三方NoneBot插件</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">  # 其他Nonebot插件的配置项</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  custom_config_1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;custom_value1&quot;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  custom_config_2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;custom_value2&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 开发者选项</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">liteyuki</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  allow_update</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 是否允许更新</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  debug</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">  # 轻雪调试，开启会自动重载Bot或者资源，其他插件自带的调试功能也将开启</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  dev_mode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 开发者模式，开启后将会启动监视者，监视文件变化并自动重载</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">...</span></span></code></pre></div><h2 id="示例-与nonebot对接的onebot实现端配置" tabindex="-1"><strong>示例：与NoneBot对接的OneBot实现端配置</strong> <a class="header-anchor" href="#示例-与nonebot对接的onebot实现端配置" aria-label="Permalink to &quot;**示例：与NoneBot对接的OneBot实现端配置**&quot;">​</a></h2><p>生产环境中推荐反向WebSocket 不同的实现端给出的字段可能不同，但是基本上都是一样的，这里给出一个参考值</p><table tabindex="0"><thead><tr><th>字段</th><th>参考值</th><th>说明</th></tr></thead><tbody><tr><td>协议</td><td>反向WebSocket</td><td>推荐使用反向ws协议进行通信，即轻雪作为服务端</td></tr><tr><td>地址</td><td>ws://127.0.0.1:20216/onebot/v11/ws</td><td>地址取决于配置文件，本机默认为<code>127.0.0.1:20216</code></td></tr><tr><td>AccessToken</td><td><code>&quot;&quot;</code></td><td>如果你给轻雪配置了<code>AccessToken</code>，请在此填写相同的值</td></tr></tbody></table><ul><li>要使用其他通信方式请访问<a href="https://onebot.adapters.nonebot.dev/" target="_blank" rel="noreferrer">OneBot Adapter</a>获取详细信息</li></ul><h2 id="其他" tabindex="-1"><strong>其他</strong> <a class="header-anchor" href="#其他" aria-label="Permalink to &quot;**其他**&quot;">​</a></h2><ul><li>轻雪不局限于OneBot适配器，你可以使用NoneBot2支持的任何适配器或使用轻雪讯息传递插件</li></ul>`,15)]))}const g=i(l,[["render",h]]);export{E as __pageData,g as default};
