1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 11:07:39 +08:00

尝试使 get_msg 获取消息中的回复信息 (#2207)

This commit is contained in:
xiangxiangxiong9 2023-08-01 11:24:59 +08:00 committed by GitHub
parent 2b1d9c21cb
commit cffdfd8181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1686,8 +1686,26 @@ func (bot *CQBot) CQGetMessage(messageID int32) global.MSG {
switch o := msg.(type) {
case *db.StoredGroupMessage:
m["group_id"] = o.GroupCode
if o.QuotedInfo != nil {
elem := global.MSG{
"type": "reply",
"data": global.MSG{
"id": strconv.FormatInt(int64(o.QuotedInfo.PrevGlobalID), 10),
},
}
o.Content = append(o.Content, elem)
}
m["message"] = ToFormattedMessage(bot.ConvertContentMessage(o.Content, message.SourceGroup), message.Source{SourceType: message.SourceGroup, PrimaryID: o.GroupCode})
case *db.StoredPrivateMessage:
if o.QuotedInfo != nil {
elem := global.MSG{
"type": "reply",
"data": global.MSG{
"id": strconv.FormatInt(int64(o.QuotedInfo.PrevGlobalID), 10),
},
}
o.Content = append(o.Content, elem)
}
m["message"] = ToFormattedMessage(bot.ConvertContentMessage(o.Content, message.SourcePrivate), message.Source{SourceType: message.SourcePrivate})
}
return OK(m)