1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

fix url share.

This commit is contained in:
Mrs4s 2021-03-04 08:56:55 +08:00
parent 39a33e4c49
commit f7b2235a99
3 changed files with 20 additions and 13 deletions

View File

@ -178,17 +178,18 @@ func privatePttDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) {
return return
} }
if len(pMsg.Body.RichText.Ptt.Reserve) != 0 { if len(pMsg.Body.RichText.Ptt.Reserve) != 0 {
//m := binary.NewReader(pMsg.Body.RichText.Ptt.Reserve[1:]).ReadTlvMap(1) // m := binary.NewReader(pMsg.Body.RichText.Ptt.Reserve[1:]).ReadTlvMap(1)
// T3 -> timestamp T8 -> voiceType T9 -> voiceLength T10 -> PbReserveStruct // T3 -> timestamp T8 -> voiceType T9 -> voiceLength T10 -> PbReserveStruct
} }
c.dispatchFriendMessage(c.parsePrivateMessage(pMsg)) c.dispatchFriendMessage(c.parsePrivateMessage(pMsg))
} }
func tempSessionDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) { func tempSessionDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) {
if pMsg.Head.C2CTmpMsgHead == nil { if pMsg.Head.C2CTmpMsgHead == nil || pMsg.Body == nil {
return return
} }
group := c.FindGroupByUin(pMsg.Head.C2CTmpMsgHead.GetGroupUin()) if pMsg.Head.GetMsgType() == 529 && pMsg.Head.GetC2CCmd() == 6 {
group := c.FindGroup(pMsg.Head.C2CTmpMsgHead.GetGroupCode())
if group == nil { if group == nil {
return return
} }
@ -196,6 +197,7 @@ func tempSessionDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) {
return return
} }
c.dispatchTempMessage(c.parseTempMessage(pMsg)) c.dispatchTempMessage(c.parseTempMessage(pMsg))
}
} }
func troopAddMemberBroadcastDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) { func troopAddMemberBroadcastDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) {

View File

@ -253,11 +253,16 @@ func NewReply(m *GroupMessage) *ReplyElement {
} }
func NewUrlShare(url, title, content, image string) *ServiceElement { func NewUrlShare(url, title, content, image string) *ServiceElement {
template := fmt.Sprintf(`<?xml version="1.0" encoding="utf-8"?><msg templateID="12345" action="web" brief="[分享] %s" serviceID="1" url="%s"><item layout="2"><picture cover="%v"/><title>%v</title><summary>%v</summary></item><source/></msg>`,
title, url, image, title, content,
)
/*
template := fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes'?><msg templateID="123" url="%s" serviceID="33" action="web" actionData="" brief="【链接】%s" flag="8"><item layout="2"><picture cover="%s"/><title>%s</title><summary>%s</summary></item></msg>`, template := fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes'?><msg templateID="123" url="%s" serviceID="33" action="web" actionData="" brief="【链接】%s" flag="8"><item layout="2"><picture cover="%s"/><title>%s</title><summary>%s</summary></item></msg>`,
url, url, image, title, content, url, url, image, title, content,
) )
*/
return &ServiceElement{ return &ServiceElement{
Id: 33, Id: 1,
Content: template, Content: template,
ResId: url, ResId: url,
SubType: "UrlShare", SubType: "UrlShare",

View File

@ -128,7 +128,7 @@ func (e *FriendImageElement) Pack() (r []*msg.Elem) {
func (e *ServiceElement) Pack() (r []*msg.Elem) { func (e *ServiceElement) Pack() (r []*msg.Elem) {
r = []*msg.Elem{} r = []*msg.Elem{}
// id =35 已移至 ForwardElement // id =35 已移至 ForwardElement
if e.Id == 33 { if e.Id == 1 {
r = append(r, &msg.Elem{ r = append(r, &msg.Elem{
Text: &msg.Text{Str: &e.ResId}, Text: &msg.Text{Str: &e.ResId},
}) })