diff --git a/client/global.go b/client/global.go
index 6c237e38..909adde3 100644
--- a/client/global.go
+++ b/client/global.go
@@ -293,10 +293,8 @@ func packUniRequestData(data []byte) []byte {
return r
}
-func genForwardTemplate(resID, preview, title, brief, source, summary string, ts int64, items []*msg.PbMultiMsgItem) *message.ForwardElement {
- template := fmt.Sprintf(`- %s %s
%s `,
- brief, resID, ts, title, preview, summary, source,
- )
+func genForwardTemplate(resID, preview, summary string, ts int64, items []*msg.PbMultiMsgItem) *message.ForwardElement {
+ template := forwardDisplay(resID, strconv.FormatInt(ts, 10), preview, summary)
for _, item := range items {
if item.GetFileName() == "MultiMsg" {
*item.FileName = strconv.FormatInt(ts, 10)
diff --git a/client/group_msg.go b/client/group_msg.go
index c6478888..56fd3f72 100644
--- a/client/group_msg.go
+++ b/client/group_msg.go
@@ -208,7 +208,7 @@ func (c *QQClient) UploadGroupForwardMessage(groupCode int64, m *message.Forward
if err != nil {
continue
}
- return genForwardTemplate(rsp.MsgResid, m.Preview(), "群聊的聊天记录", "[聊天记录]", "聊天记录", fmt.Sprintf("查看 %d 条转发消息", m.Length()), ts, items)
+ return genForwardTemplate(rsp.MsgResid, m.Preview(), fmt.Sprintf("查看 %d 条转发消息", m.Length()), ts, items)
}
return nil
}
diff --git a/client/multimsg.go b/client/multimsg.go
index 6cead481..0348f903 100644
--- a/client/multimsg.go
+++ b/client/multimsg.go
@@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"math"
+ "strings"
"time"
"github.com/pkg/errors"
@@ -202,9 +203,28 @@ func (c *QQClient) DownloadForwardMessage(resId string) *message.ForwardElement
fmt.Fprintf(&pv, `
%s: %s`, sender, brief)
}
return genForwardTemplate(
- resId, pv.String(), "群聊的聊天记录", "[聊天记录]", "聊天记录",
+ resId, pv.String(),
fmt.Sprintf("查看 %d 条转发消息", len(multiMsg.Msg)),
time.Now().UnixNano(),
multiMsg.PbItemList,
)
}
+
+func forwardDisplay(resID, fileName, preview, summary string) string {
+ sb := strings.Builder{}
+ sb.WriteString(`- 群聊的聊天记录 `)
+ sb.WriteString(preview)
+ sb.WriteString(`
`)
+ sb.WriteString(summary)
+ // todo: 私聊的聊天记录?
+ sb.WriteString(` `)
+ return sb.String()
+}