Simple Robot v4.6.0 Help

Bot配置文件

示例

{ "component": "simbot.qqguild", "ticket": { "appId": "你的botId", "secret": "你的bot secret, 用于获取API的access_token(4.0.0-beta6开始)", "token": "你的bot token, 用作API的access_token(4.0.0-beta6之前)" } }
{ "component": "simbot.qqguild", "ticket": { "appId": "你的botId", "secret": "你的bot secret, 用于获取API的access_token(4.0.0-beta6开始)", "token": "你的bot token, 用作API的access_token(4.0.0-beta6之前)" }, "config": { "serverUrl": null, "shard": { "type": "full" }, "intents": { "type": "raw", "intents": 1073741827 }, "clientProperties": null, "timeout": null, "cache": { "enable": true, "transmit": null, "dynamic": null, "dispatcher": null } } }

属性描述

component

固定值: simbot.qqguild

ticket

bot用于登录的票据信息,必填。

appId

String

bot开发配置中的 appID

secret

String

bot开发配置中的 AppSecret, 4.0.0-beta6 版本开始用于获取API访问所需的 access_token

token

String

bot开发配置中的 Token4.0.0-beta6 版本之前用作API访问所需的 token。

config

可选项,提供一些额外的可配置属性。

serverUrl

String

目标服务器地址。默认为 null

当值为特殊值: "SANDBOX" 时会选择使用 QQGuild.SANDBOX_URL_STRING, 也就是沙箱服务器地址。

配置值

实际值

null

"https://api.sgroup.qq.com"

"SANDBOX"

"https://sandbox.api.sgroup.qq.com"

其他

与配置值一致

shard

ShardConfig

分片信息配置,默认为 Full

根据 type 值的不同,可使用不同的属性。

type='full'

无额外属性,代表一个全量单片。

{ "type": "full" }
type='simple'
{ "type": "simple", "value": 0, "total": 1 }
value

对应的分片信息属性。

total

对应的分片信息属性。

intents

IntentsConfig?

要订阅的事件的 intents 信息。默认 1073741827, 也就是订阅:

  • 频道相关事件

  • 频道成员相关事件

  • 公域消息相关事件

根据 type 的不同可选的属性不同。

type='raw'

直接使用 intents 原始的标记位最终数值。

所有的事件对应的位值信息可前往参考 官方文档

{ "type": "raw", "intents": 1073741824 }
type='nameBased'

通过名称寻找所有可用的 EventIntents 并合并为最终的 intents。 名称基于继承了 EventIntents 的 object 的简单名称,例如 Guilds

名称支持开头大写或小写的驼峰,例如 Guilds, guilds, 或者全大写或全小写的snake(下划线)格式,例如 PUBLIC_GUILD_MESSAGES, public_guild_messages

虽然支持的格式比较宽松,但名称匹配仍然是区分大小写的, 比如一个混用大小写的snake格式就是不允许的: public_GUILD_messages ❌。

{ "type": "nameBased", "names": ["Guilds", "PublicGuildMessages"] }
type='bitBased'

通过 intents 的位索引值来配置 intents 的结果。

{ "type": "bitBased", "bits": [0, 1, 30] }

上面的 0, 1, 30 即代表订阅 1<<0 | 1<<1 | 1<<30

bits 的元素值应当在 0 ~ 31 之内,但是代码内不做校验。

clientProperties

Map<String, String>?

用作 Signal.Identify.Data.properties 中的参数。

{ "config": { "clientProperties": { "k1": "v1", "foo": "bar" } } }
timeout

TimeoutConfig?

与部分超时相关的配置信息。 当任意属性不为 null 时会为 bot 中用于请求API的 HttpClient 配置 HttpTimeout 插件。

默认为 null

apiHttpRequestTimeoutMillis

Long?

API请求中的超时请求配置。参考 HttpTimeout 中的相关说明。

默认为 null

apiHttpConnectTimeoutMillis

Long?

API请求中的超时请求配置。参考 HttpTimeout 中的相关说明。

默认为 null

apiHttpSocketTimeoutMillis

Long?

API请求中的超时请求配置。参考 HttpTimeout 中的相关说明。

默认为 null

cache

CacheConfig?

缓存相关配置。

"config": { "cache": { "transmit": { "enable": true } } }

有关 transmit 的详细描述, 请参考 TransmitCacheConfig 的文档注释或 API Doc。

Last modified: 12 September 2024