From 15069b74b35d928c422a4607bd527ae951ea7c06 Mon Sep 17 00:00:00 2001 From: BeautyyuYanli Date: Tue, 31 Jan 2023 17:05:43 +0800 Subject: [PATCH] support SetGroupAnonymous (#312) --- client/builders.go | 15 +++++++++++++++ client/client.go | 4 ++++ client/group_info.go | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/client/builders.go b/client/builders.go index 8913cdf7..8d65fd7d 100644 --- a/client/builders.go +++ b/client/builders.go @@ -1196,3 +1196,18 @@ func (c *QQClient) buildUpdateProfileDetailPacket(profileRecord map[uint16][]byt cl() return c.uniPacket("OidbSvc.0x4ff_9_IMCore", payload) } + +// OidbSvc.0x568_22 +func (c *QQClient) buildSetGroupAnonymous(groupCode int64, enable bool) (uint16, []byte) { + var t byte = 0 + if enable { + t = 1 + } + b, cl := binary.OpenWriterF(func(w *binary.Writer) { + w.WriteUInt32(uint32(groupCode)) + w.WriteByte(t) + }) + payload := c.packOIDBPackage(1384, 22, b) + cl() + return c.uniPacket("OidbSvc.0x568_22", payload) +} diff --git a/client/client.go b/client/client.go index d4632302..19008683 100644 --- a/client/client.go +++ b/client/client.go @@ -790,6 +790,10 @@ func (g *GroupInfo) removeMember(uin int64) { }) } +func (c *QQClient) setGroupAnonymous(groupCode int64, enable bool) { + _, _ = c.sendAndWait(c.buildSetGroupAnonymous(groupCode, enable)) +} + // UpdateProfile 修改个人资料 func (c *QQClient) UpdateProfile(profile ProfileDetailUpdate) { _, _ = c.sendAndWait(c.buildUpdateProfileDetailPacket(profile)) diff --git a/client/group_info.go b/client/group_info.go index 8c7544d7..e303c4ca 100644 --- a/client/group_info.go +++ b/client/group_info.go @@ -408,6 +408,12 @@ func (m *GroupMemberInfo) Mute(time uint32) error { } } +func (g *GroupInfo) SetAnonymous(enable bool) { + if g.AdministratorOrOwner() { + g.client.setGroupAnonymous(g.Code, enable) + } +} + func (m *GroupMemberInfo) Manageable() bool { if m.Uin == m.Group.client.Uin { return true