1
0
mirror of https://github.com/fumiama/go-onebot-agent.git synced 2026-06-12 06:00:24 +08:00

chore: make lint happy

This commit is contained in:
源文雨
2025-09-26 00:00:05 +08:00
parent 46ace7c2b1
commit 4a13d48870
2 changed files with 3 additions and 1 deletions

View File

@@ -60,7 +60,7 @@ func (ag *Agent) AddRequest(grp int64, req *zero.APIRequest) {
ag.log.Add(grp, req, true) ag.log.Add(grp, req, true)
} }
// AddRequest 添加在执行完 zero.APIRequest 之后得到的响应 // AddResponse 添加在执行完 zero.APIRequest 之后得到的响应
func (ag *Agent) AddResponse(grp int64, resp *APIResponse) { func (ag *Agent) AddResponse(grp int64, resp *APIResponse) {
ag.log.Add(grp, resp, false) ag.log.Add(grp, resp, false)
} }

View File

@@ -39,6 +39,7 @@ func (ev *Event) String() string {
return strings.TrimSpace(sb.String()) return strings.TrimSpace(sb.String())
} }
// APIResponse is the simplified OneBot response
type APIResponse struct { type APIResponse struct {
Status string `json:"status"` Status string `json:"status"`
Data json.RawMessage `json:"data"` Data json.RawMessage `json:"data"`
@@ -47,6 +48,7 @@ type APIResponse struct {
RetCode int64 `json:"retcode"` RetCode int64 `json:"retcode"`
} }
// String dumps JSON without tailing \n
func (resp *APIResponse) String() string { func (resp *APIResponse) String() string {
sb := strings.Builder{} sb := strings.Builder{}
err := json.NewEncoder(&sb).Encode(resp) err := json.NewEncoder(&sb).Encode(resp)