Skip to content

Commit c9f561b

Browse files
committed
增加qq组件intents的 bitBased 格式
1 parent 350f3e1 commit c9f561b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Writerside/topics/component-qq-guild-bot-config.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ bot开发配置中的 `Token`。
192192
<def title="type='nameBased'">
193193

194194
通过名称寻找所有可用的 `EventIntents` 并合并为最终的 `intents`
195-
名称基于继承了 `EventIntents` 的 object 的简单类名,例如 `Guilds`
195+
名称基于继承了 `EventIntents` 的 object 的简单名称,例如 `Guilds`
196+
197+
名称支持开头大写或小写的驼峰,例如 `Guilds`, `guilds`,
198+
或者全大写或全小写的snack(下划线)格式,例如 `PUBLIC_GUILD_MESSAGES`, `public_guild_messages`
199+
200+
虽然支持的格式比较宽松,但名称匹配仍然是**区分大小写**的,
201+
比如一个混用大小写的snack格式就是不允许的:`public_GUILD_messages` ❌。
196202

197203
```json
198204
{
@@ -201,6 +207,23 @@ bot开发配置中的 `Token`。
201207
}
202208
```
203209

210+
</def>
211+
<def title="type='bitBased'">
212+
<note>自 <code>4.0.0-beta7</code> 开始支持</note>
213+
214+
通过 `intents` 的位索引值来配置 `intents` 的结果。
215+
216+
```json
217+
{
218+
"type": "bitBased",
219+
"bits": [0, 1, 30]
220+
}
221+
```
222+
223+
上面的 `0, 1, 30` 即代表订阅 `1<<0 | 1<<1 | 1<<30`
224+
225+
`bits` 的元素值应当在 0 ~ 31 之内,但是代码内不做校验。
226+
204227
</def>
205228
</deflist>
206229

0 commit comments

Comments
 (0)