1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-06 20:13:50 +08:00

rf(api): simply get user_id

This commit is contained in:
wdvxdr 2021-06-19 21:25:38 +08:00
parent a117d67286
commit 7c5bd64e9b
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6

View File

@ -433,7 +433,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) MSG {
} }
ts.Add(time.Second) ts.Add(time.Second)
if e.Get("data.id").Exists() { if e.Get("data.id").Exists() {
i, _ := strconv.Atoi(e.Get("data.id").String()) i := e.Get("data.id").Int()
m := bot.GetMessage(int32(i)) m := bot.GetMessage(int32(i))
if m != nil { if m != nil {
sender := m["sender"].(message.Sender) sender := m["sender"].(message.Sender)
@ -454,10 +454,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) MSG {
log.Warnf("警告: 引用消息 %v 错误或数据库未开启.", e.Get("data.id").Str) log.Warnf("警告: 引用消息 %v 错误或数据库未开启.", e.Get("data.id").Str)
return return
} }
uin, _ := strconv.ParseInt(e.Get("data.uin").Str, 10, 64) uin := e.Get("data.[user_id,uin].0").Int()
if uin == 0 {
uin, _ = strconv.ParseInt(e.Get("data.user_id").Str, 10, 64)
}
msgTime, err := strconv.ParseInt(e.Get("data.time").Str, 10, 64) msgTime, err := strconv.ParseInt(e.Get("data.time").Str, 10, 64)
if err != nil { if err != nil {
msgTime = ts.Unix() msgTime = ts.Unix()