diff --git a/agent.go b/agent.go index deab68a..6340287 100644 --- a/agent.go +++ b/agent.go @@ -60,7 +60,7 @@ func (ag *Agent) AddRequest(grp int64, req *zero.APIRequest) { ag.log.Add(grp, req, true) } -// AddRequest 添加在执行完 zero.APIRequest 之后得到的响应 +// AddResponse 添加在执行完 zero.APIRequest 之后得到的响应 func (ag *Agent) AddResponse(grp int64, resp *APIResponse) { ag.log.Add(grp, resp, false) } diff --git a/types.go b/types.go index ff8dcf8..5130d4b 100644 --- a/types.go +++ b/types.go @@ -39,6 +39,7 @@ func (ev *Event) String() string { return strings.TrimSpace(sb.String()) } +// APIResponse is the simplified OneBot response type APIResponse struct { Status string `json:"status"` Data json.RawMessage `json:"data"` @@ -47,6 +48,7 @@ type APIResponse struct { RetCode int64 `json:"retcode"` } +// String dumps JSON without tailing \n func (resp *APIResponse) String() string { sb := strings.Builder{} err := json.NewEncoder(&sb).Encode(resp)