From 3bfdc4d8a29227474e0fa817aeab2be9291720b1 Mon Sep 17 00:00:00 2001 From: nnnewb Date: Sat, 13 Feb 2021 18:24:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=8E=9F=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=20isAnonymous=20=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coolq/api.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coolq/api.go b/coolq/api.go index da5f20e..5e94212 100644 --- a/coolq/api.go +++ b/coolq/api.go @@ -805,7 +805,7 @@ func (bot *CQBot) CQGetStrangerInfo(userID int64) MSG { func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) MSG { postType := context.Get("post_type").Str anonymous := context.Get("anonymous") - isAnonymous := anonymous.Type == gjson.Null + isAnonymous := anonymous.Type != gjson.Null switch postType { case "message": @@ -830,8 +830,9 @@ func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) MSG { }, }) - err := json.UnmarshalFromString(reply.Raw, replySegments) + err := json.UnmarshalFromString(reply.Raw, &replySegments) if err != nil { + log.WithError(err).Warnf("处理 at_sender 过程中发生错误") return Failed(-1, "处理 at_sender 过程中发生错误", err.Error()) } @@ -839,6 +840,7 @@ func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) MSG { modified, err := json.MarshalToString(segments) if err != nil { + log.WithError(err).Warnf("处理 at_sender 过程中发生错误") return Failed(-1, "处理 at_sender 过程中发生错误", err.Error()) }