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