mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
coolq: make animated sticker subset of face message
This commit is contained in:
parent
7e573f9be6
commit
2fc7f995f2
@ -246,8 +246,8 @@ func ToArrayMessage(e []message.IMessageElement, source MessageSource) (r []glob
|
||||
}
|
||||
case *message.AnimatedSticker:
|
||||
m = global.MSG{
|
||||
"type": "sticker",
|
||||
"data": map[string]string{"id": strconv.FormatInt(int64(o.ID), 10)},
|
||||
"type": "face",
|
||||
"data": map[string]string{"id": strconv.FormatInt(int64(o.ID), 10), "type": "sticker"},
|
||||
}
|
||||
default:
|
||||
continue
|
||||
@ -367,7 +367,7 @@ func ToStringMessage(e []message.IMessageElement, source MessageSource, isRaw ..
|
||||
case *message.LightAppElement:
|
||||
write(`[CQ:json,data=%s]`, CQCodeEscapeValue(o.Content))
|
||||
case *message.AnimatedSticker:
|
||||
write(`[CQ:sticker,id=%d]`, o.ID)
|
||||
write(`[CQ:face,id=%d,type=sticker]`, o.ID)
|
||||
}
|
||||
}
|
||||
r = sb.String() // 内部已拷贝
|
||||
@ -475,8 +475,8 @@ func ToMessageContent(e []message.IMessageElement) (r []global.MSG) {
|
||||
}
|
||||
case *message.AnimatedSticker:
|
||||
m = global.MSG{
|
||||
"type": "sticker",
|
||||
"data": global.MSG{"id": o.ID},
|
||||
"type": "face",
|
||||
"data": global.MSG{"id": o.ID, "type": "sticker"},
|
||||
}
|
||||
default:
|
||||
continue
|
||||
@ -934,17 +934,14 @@ func (bot *CQBot) ToElement(t string, d map[string]string, sourceType MessageSou
|
||||
}
|
||||
}
|
||||
return &message.VoiceElement{Data: data}, nil
|
||||
case "sticker":
|
||||
id, err := strconv.Atoi(d["id"])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &message.AnimatedSticker{ID: int32(id)}, nil
|
||||
case "face":
|
||||
id, err := strconv.Atoi(d["id"])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if d["type"] == "sticker" {
|
||||
return &message.AnimatedSticker{ID: int32(id)}, nil
|
||||
}
|
||||
return message.NewFace(int32(id)), nil
|
||||
case "at":
|
||||
qq := d["qq"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user