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

move reply pos. close #220

This commit is contained in:
Mrs4s 2020-09-05 08:02:31 +08:00
parent 7d3265b6d4
commit 49e3995129

View File

@ -32,6 +32,17 @@ func ToArrayMessage(e []message.IMessageElement, code int64, raw ...bool) (r []M
if len(raw) != 0 { if len(raw) != 0 {
ur = raw[0] ur = raw[0]
} }
m := &message.SendingMessage{Elements: e}
reply := m.FirstOrNil(func(e message.IMessageElement) bool {
_, ok := e.(*message.ReplyElement)
return ok
})
if reply != nil {
r = append(r, MSG{
"type": "reply",
"data": map[string]string{"id": fmt.Sprint(ToGlobalId(code, o.ReplySeq))},
})
}
for _, elem := range e { for _, elem := range e {
m := MSG{} m := MSG{}
switch o := elem.(type) { switch o := elem.(type) {
@ -52,11 +63,6 @@ func ToArrayMessage(e []message.IMessageElement, code int64, raw ...bool) (r []M
"data": map[string]string{"qq": fmt.Sprint(o.Target)}, "data": map[string]string{"qq": fmt.Sprint(o.Target)},
} }
} }
case *message.ReplyElement:
m = MSG{
"type": "reply",
"data": map[string]string{"id": fmt.Sprint(ToGlobalId(code, o.ReplySeq))},
}
case *message.ForwardElement: case *message.ForwardElement:
m = MSG{ m = MSG{
"type": "forward", "type": "forward",