mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-05 03:23:50 +08:00
feat: support send guild music share
This commit is contained in:
parent
503db83375
commit
abe1fe7770
@ -14,6 +14,7 @@ type DB77ReqBody struct {
|
|||||||
SendType uint32 `protobuf:"varint,10,opt"`
|
SendType uint32 `protobuf:"varint,10,opt"`
|
||||||
RecvUin uint64 `protobuf:"varint,11,opt"`
|
RecvUin uint64 `protobuf:"varint,11,opt"`
|
||||||
RichMsgBody *DB77RichMsgBody `protobuf:"bytes,12,opt"`
|
RichMsgBody *DB77RichMsgBody `protobuf:"bytes,12,opt"`
|
||||||
|
RecvGuildId uint64 `protobuf:"varint,19,opt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB77ReqBody) GetAppId() uint64 {
|
func (x *DB77ReqBody) GetAppId() uint64 {
|
||||||
@ -86,6 +87,13 @@ func (x *DB77ReqBody) GetRichMsgBody() *DB77RichMsgBody {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DB77ReqBody) GetRecvGuildId() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.RecvGuildId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type DB77ClientInfo struct {
|
type DB77ClientInfo struct {
|
||||||
Platform uint32 `protobuf:"varint,1,opt"`
|
Platform uint32 `protobuf:"varint,1,opt"`
|
||||||
SdkVersion string `protobuf:"bytes,2,opt"`
|
SdkVersion string `protobuf:"bytes,2,opt"`
|
||||||
|
@ -13,6 +13,7 @@ message DB77ReqBody {
|
|||||||
uint32 sendType = 10;
|
uint32 sendType = 10;
|
||||||
uint64 recvUin = 11;
|
uint64 recvUin = 11;
|
||||||
DB77RichMsgBody richMsgBody = 12;
|
DB77RichMsgBody richMsgBody = 12;
|
||||||
|
uint64 recvGuildId = 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DB77ClientInfo {
|
message DB77ClientInfo {
|
||||||
|
@ -77,7 +77,7 @@ func (c *QQClient) SendGroupMusicShare(target int64, msg *message.MusicShareElem
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
defer c.onGroupMessageReceipt(eid)
|
defer c.onGroupMessageReceipt(eid)
|
||||||
_, _ = c.sendAndWait(c.buildRichMsgSendingPacket(target, msg, 1)) // rsp is empty chunk
|
_, _ = c.sendAndWait(c.buildRichMsgSendingPacket(0, target, msg, 1)) // rsp is empty chunk
|
||||||
select {
|
select {
|
||||||
case ret := <-ch:
|
case ret := <-ch:
|
||||||
return ret, nil
|
return ret, nil
|
||||||
@ -88,11 +88,17 @@ func (c *QQClient) SendGroupMusicShare(target int64, msg *message.MusicShareElem
|
|||||||
|
|
||||||
// SendFriendMusicShare 发送好友音乐卡片
|
// SendFriendMusicShare 发送好友音乐卡片
|
||||||
func (c *QQClient) SendFriendMusicShare(target int64, msg *message.MusicShareElement) {
|
func (c *QQClient) SendFriendMusicShare(target int64, msg *message.MusicShareElement) {
|
||||||
_, _ = c.sendAndWait(c.buildRichMsgSendingPacket(target, msg, 0))
|
_, _ = c.sendAndWait(c.buildRichMsgSendingPacket(0, target, msg, 0))
|
||||||
|
}
|
||||||
|
|
||||||
|
// SendGuildMusicShare 发送频道音乐卡片
|
||||||
|
func (c *QQClient) SendGuildMusicShare(guildID, channelID uint64, msg *message.MusicShareElement) {
|
||||||
|
// todo(wdvxdr): message receipt?
|
||||||
|
_, _ = c.sendAndWait(c.buildRichMsgSendingPacket(guildID, int64(channelID), msg, 3))
|
||||||
}
|
}
|
||||||
|
|
||||||
// OidbSvc.0xb77_9
|
// OidbSvc.0xb77_9
|
||||||
func (c *QQClient) buildRichMsgSendingPacket(target int64, msg *message.MusicShareElement, sendType uint32) (uint16, []byte) {
|
func (c *QQClient) buildRichMsgSendingPacket(guild uint64, target int64, msg *message.MusicShareElement, sendType uint32) (uint16, []byte) {
|
||||||
seq := c.nextSeq()
|
seq := c.nextSeq()
|
||||||
tp := musicType[msg.MusicType] // MusicType
|
tp := musicType[msg.MusicType] // MusicType
|
||||||
body := &oidb.DB77ReqBody{
|
body := &oidb.DB77ReqBody{
|
||||||
@ -121,6 +127,7 @@ func (c *QQClient) buildRichMsgSendingPacket(target int64, msg *message.MusicSha
|
|||||||
PictureUrl: msg.PictureUrl,
|
PictureUrl: msg.PictureUrl,
|
||||||
MusicUrl: msg.MusicUrl,
|
MusicUrl: msg.MusicUrl,
|
||||||
},
|
},
|
||||||
|
RecvGuildId: guild,
|
||||||
}
|
}
|
||||||
b, _ := proto.Marshal(body)
|
b, _ := proto.Marshal(body)
|
||||||
payload := c.packOIDBPackage(2935, 9, b)
|
payload := c.packOIDBPackage(2935, 9, b)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user