1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +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

@ -185,10 +185,11 @@ func privatePttDecoder(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
}
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 {
return
}
@ -197,6 +198,7 @@ func tempSessionDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) {
}
c.dispatchTempMessage(c.parseTempMessage(pMsg))
}
}
func troopAddMemberBroadcastDecoder(c *QQClient, pMsg *msg.Message, _ *c2cExtraOption) {
groupJoinLock.Lock()

View File

@ -253,11 +253,16 @@ func NewReply(m *GroupMessage) *ReplyElement {
}
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>`,
url, url, image, title, content,
)
*/
return &ServiceElement{
Id: 33,
Id: 1,
Content: template,
ResId: url,
SubType: "UrlShare",

View File

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