Skip to content

Commit

Permalink
fixed: onebot客户端主动上报器注释后依旧上报
Browse files Browse the repository at this point in the history
  • Loading branch information
Clov614 committed Oct 14, 2024
1 parent 02e0fcc commit a0180c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rikkabot/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ func (c *CommonConfig) verifiability() {
c.AnswerDelayRandMin = defaultAnswerDelayRandMin
c.AnswerDelayRandMax = defaultAnswerDelayRandMax
}
// 校验 http post 列表是否为空视为不开启主动post
if len(c.HttpPost) == 1 && c.HttpPost[0].Url == "" && c.HttpPost[0].Secret == "" && c.HttpPost[0].MaxRetries == 0 {
c.HttpPost = []HttpPostConfig{}
}

}

Expand Down Expand Up @@ -155,8 +159,8 @@ func init() {
}
logging.ErrorWithErr(err, "error load config")
}
config.verifiability() // 校验设置项是否合规
err = configutil.Save(&config, defaultPath, defaultSaveFileName)
config.verifiability() // 校验设置项是否合规
if err != nil {
logging.ErrorWithErr(err, "error saving config")
}
Expand Down
1 change: 1 addition & 0 deletions rikkabot/onebot/httpapi/httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ func (c HttpClient) HandlerPostEvent(event event.IEvent) {
req, err = http.NewRequest("POST", c.postUrl, bytes.NewBuffer(eventJSON))
if err != nil {
logHttpPostError(event, err, "request create failed")
rikkabot.Bot().ExitWithErr(1102, err.Error())
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+encrypt(c.secret))
Expand Down

0 comments on commit a0180c7

Please sign in to comment.