mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 20:13:50 +08:00
fix #89.
This commit is contained in:
parent
5e49820319
commit
3c04573e82
@ -85,7 +85,7 @@ func (bot *CQBot) GetGroupMessage(mid int32) MSG {
|
||||
if err == nil {
|
||||
return m
|
||||
}
|
||||
log.Warnf("获取信息时出现错误: %v", err)
|
||||
log.Warnf("获取信息时出现错误: %v id: %v", err, mid)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ type JsonConfig struct {
|
||||
HttpConfig *GoCQHttpConfig `json:"http_config"`
|
||||
WSConfig *GoCQWebsocketConfig `json:"ws_config"`
|
||||
ReverseServers []*GoCQReverseWebsocketConfig `json:"ws_reverse_servers"`
|
||||
PostMessageFormat string `json:"post_message_format"`
|
||||
Debug bool `json:"debug"`
|
||||
}
|
||||
|
||||
@ -40,12 +41,11 @@ type CQHttpApiConfig struct {
|
||||
}
|
||||
|
||||
type GoCQHttpConfig struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Host string `json:"host"`
|
||||
Port uint16 `json:"port"`
|
||||
Timeout int32 `json:"timeout"`
|
||||
PostUrls map[string]string `json:"post_urls"`
|
||||
PostMessageFormat string `json:"post_message_format"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Host string `json:"host"`
|
||||
Port uint16 `json:"port"`
|
||||
Timeout int32 `json:"timeout"`
|
||||
PostUrls map[string]string `json:"post_urls"`
|
||||
}
|
||||
|
||||
type GoCQWebsocketConfig struct {
|
||||
|
16
main.go
16
main.go
@ -96,18 +96,18 @@ func main() {
|
||||
Uin: uin,
|
||||
Password: pwd,
|
||||
HttpConfig: &global.GoCQHttpConfig{
|
||||
Enabled: true,
|
||||
Host: "0.0.0.0",
|
||||
Port: 5700,
|
||||
PostUrls: map[string]string{},
|
||||
PostMessageFormat: "string",
|
||||
Enabled: true,
|
||||
Host: "0.0.0.0",
|
||||
Port: 5700,
|
||||
PostUrls: map[string]string{},
|
||||
},
|
||||
WSConfig: &global.GoCQWebsocketConfig{
|
||||
Enabled: true,
|
||||
Host: "0.0.0.0",
|
||||
Port: 6700,
|
||||
},
|
||||
Debug: os.Getenv("DEBUG") == "true",
|
||||
PostMessageFormat: "string",
|
||||
Debug: os.Getenv("DEBUG") == "true",
|
||||
}
|
||||
if post != "" {
|
||||
conf.HttpConfig.PostUrls[post] = os.Getenv("HTTP_SECRET")
|
||||
@ -200,11 +200,11 @@ func main() {
|
||||
b := coolq.NewQQBot(cli, conf)
|
||||
if conf.HttpConfig != nil && conf.HttpConfig.Enabled {
|
||||
server.HttpServer.Run(fmt.Sprintf("%s:%d", conf.HttpConfig.Host, conf.HttpConfig.Port), conf.AccessToken, b)
|
||||
if conf.HttpConfig.PostMessageFormat != "string" && conf.HttpConfig.PostMessageFormat != "array" {
|
||||
if conf.PostMessageFormat != "string" && conf.PostMessageFormat != "array" {
|
||||
log.Warnf("http_config.post_message_format 配置错误, 将自动使用 string")
|
||||
coolq.SetMessageFormat("string")
|
||||
} else {
|
||||
coolq.SetMessageFormat(conf.HttpConfig.PostMessageFormat)
|
||||
coolq.SetMessageFormat(conf.PostMessageFormat)
|
||||
}
|
||||
for k, v := range conf.HttpConfig.PostUrls {
|
||||
server.NewHttpClient().Run(k, v, conf.HttpConfig.Timeout, b)
|
||||
|
Loading…
x
Reference in New Issue
Block a user