From 7e750352c4e16339393e4ea531e0f46dfee3d957 Mon Sep 17 00:00:00 2001 From: Akiba Date: Sat, 25 Jun 2022 21:06:37 +0800 Subject: [PATCH] fix: #1558 --- coolq/api.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/coolq/api.go b/coolq/api.go index a16636e..7b5b95f 100644 --- a/coolq/api.go +++ b/coolq/api.go @@ -875,6 +875,12 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType i := e.Get("data.id").Int() m, _ := db.GetMessageByGlobalID(int32(i)) if m != nil { + mSource := func() message.SourceType { + if m.GetType() == "group" { + return message.SourceGroup + } + return message.SourcePrivate + }() msgTime := m.GetAttribute().Timestamp if msgTime == 0 { msgTime = ts.Unix() @@ -883,7 +889,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType SenderId: m.GetAttribute().SenderUin, SenderName: m.GetAttribute().SenderName, Time: int32(msgTime), - Message: resolveElement(bot.ConvertContentMessage(m.GetContent(), message.SourceGroup)), + Message: resolveElement(bot.ConvertContentMessage(m.GetContent(), mSource)), } } log.Warnf("警告: 引用消息 %v 错误或数据库未开启.", e.Get("data.id").Str) @@ -916,7 +922,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType } } } - content := bot.ConvertObjectMessage(c, message.SourceGroup) + content := bot.ConvertObjectMessage(c, sourceType) if uin != 0 && name != "" && len(content) > 0 { return &message.ForwardNode{ SenderId: uin,