From 898430f0da38f9146d76ecc09d1b4fe32ca3029c Mon Sep 17 00:00:00 2001 From: WindowsSov8forUs Date: Thu, 10 Oct 2024 14:53:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E9=A2=91=E9=81=93=20at=20=E6=B6=88=E6=81=AF=E6=97=B6=20at=20?= =?UTF-8?q?=E5=86=85=20id=20=E4=B8=8E=E6=9C=BA=E5=99=A8=E4=BA=BA=20id=20?= =?UTF-8?q?=E4=B8=8D=E7=AC=A6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- processor/message_processor.go | 7 +++++++ server/httpapi/login_get.go | 3 +++ 2 files changed, 10 insertions(+) diff --git a/processor/message_processor.go b/processor/message_processor.go index 0993a2e..645801f 100644 --- a/processor/message_processor.go +++ b/processor/message_processor.go @@ -471,6 +471,13 @@ func ConvertToMessageContent(data interface{}) string { id := strings.TrimPrefix(strings.TrimSuffix(r, ">"), "<@!") for _, mention := range msg.Mentions { if mention.ID == id { + // 如果是机器人自己则进行替换 + // + // 这种时候一般来说都是频道 + if id == SelfId { + id = GetBot("qqguild").Id + } + at := satoriMessage.MessageElementAt{ Id: mention.ID, Name: mention.Username, diff --git a/server/httpapi/login_get.go b/server/httpapi/login_get.go index ff95159..217a401 100644 --- a/server/httpapi/login_get.go +++ b/server/httpapi/login_get.go @@ -29,6 +29,9 @@ func HandleLoginGet(api, apiv2 openapi.OpenAPI, message *ActionMessage) (any, AP return gin.H{}, &InternalServerError{err} } + // 更新 SelfID + processor.SelfId = me.ID + // 构建机器人对象 bot := &user.User{ Id: processor.GetBot(message.Platform).Id,