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

member mute supported.

This commit is contained in:
Mrs4s 2020-07-22 03:52:52 +08:00
parent 39aac304f5
commit 2accd73f8b
4 changed files with 33 additions and 1 deletions

View File

@ -57,4 +57,5 @@ qq-android协议的golang实现 移植于Mirai
- [x] 修改群成员Card - [x] 修改群成员Card
- [x] 修改群成员头衔 - [x] 修改群成员头衔
- [ ] 群成员邀请 - [ ] 群成员邀请
- [ ] T出群成员 - [x] 群成员禁言/解除禁言
- [x] T出群成员

View File

@ -794,3 +794,22 @@ func (c *QQClient) buildGroupKickPacket(groupCode, memberUin int64, kickMsg stri
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0x8a0_0", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0x8a0_0", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet return seq, packet
} }
// OidbSvc.0x570_8
func (c *QQClient) buildGroupMutePacket(groupCode, memberUin int64, time uint32) (uint16, []byte) {
seq := c.nextSeq()
req := &oidb.OIDBSSOPkg{
Command: 1392,
ServiceType: 8,
Bodybuffer: binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt32(uint32(groupCode))
w.WriteByte(32)
w.WriteUInt16(1)
w.WriteUInt32(uint32(memberUin))
w.WriteUInt32(time)
}),
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0x570_8", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}

View File

@ -465,6 +465,10 @@ func (c *QQClient) groupMuteAll(groupCode int64, mute bool) {
_, _ = c.sendAndWait(c.buildGroupMuteAllPacket(groupCode, mute)) _, _ = c.sendAndWait(c.buildGroupMuteAllPacket(groupCode, mute))
} }
func (c *QQClient) groupMute(groupCode, memberUin int64, time uint32) {
_, _ = c.sendAndWait(c.buildGroupMutePacket(groupCode, memberUin, time))
}
func (c *QQClient) kickGroupMember(groupCode, memberUin int64, msg string) { func (c *QQClient) kickGroupMember(groupCode, memberUin int64, msg string) {
_, _ = c.sendAndWait(c.buildGroupKickPacket(groupCode, memberUin, msg)) _, _ = c.sendAndWait(c.buildGroupKickPacket(groupCode, memberUin, msg))
} }

View File

@ -215,6 +215,14 @@ func (m *GroupMemberInfo) Kick(msg string) {
} }
} }
func (m *GroupMemberInfo) Mute(time uint32) {
if m.Uin != m.Group.client.Uin && m.Manageable() {
if time < 2592000 {
m.Group.client.groupMute(m.Group.Code, m.Uin, time)
}
}
}
func (m *GroupMemberInfo) Manageable() bool { func (m *GroupMemberInfo) Manageable() bool {
if m.Uin == m.Group.client.Uin { if m.Uin == m.Group.client.Uin {
return true return true