mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-05 18:50:24 +08:00
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package nano
|
|
|
|
// GetGeneralWSSGateway 获取通用 WSS 接入点
|
|
//
|
|
// https://bot.q.qq.com/wiki/develop/api/openapi/wss/url_get.html
|
|
func (bot *Bot) GetGeneralWSSGateway() (string, error) {
|
|
resp := struct {
|
|
CodeMessageBase
|
|
U string `json:"url"`
|
|
}{}
|
|
err := bot.GetOpenAPI("/gateway", &resp)
|
|
return resp.U, err
|
|
}
|
|
|
|
// ShardWSSGateway 带分片 WSS 接入点响应数据
|
|
//
|
|
// https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html#%E8%BF%94%E5%9B%9E
|
|
type ShardWSSGateway struct {
|
|
URL string `json:"url"`
|
|
Shards int `json:"shards"`
|
|
SessionStartLimit struct {
|
|
Total int `json:"total"`
|
|
Remaining int `json:"remaining"`
|
|
ResetAfter int `json:"reset_after"`
|
|
MaxConcurrency int `json:"max_concurrency"`
|
|
} `json:"session_start_limit"`
|
|
}
|
|
|
|
// GetShardWSSGateway 获取带分片 WSS 接入点
|
|
//
|
|
// https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html
|
|
func (bot *Bot) GetShardWSSGateway() (*ShardWSSGateway, error) {
|
|
return bot.getOpenAPIofShardWSSGateway("/gateway/bot")
|
|
}
|