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

add: SetAdmin().

This commit is contained in:
Mrs4s 2020-09-09 18:32:04 +08:00
parent dde8bded28
commit 808a63a78e
3 changed files with 32 additions and 0 deletions

View File

@ -915,6 +915,28 @@ func (c *QQClient) buildGroupMutePacket(groupCode, memberUin int64, time uint32)
return seq, packet
}
// OidbSvc.0x55c_1
func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool) (uint16, []byte) {
seq := c.nextSeq()
req := &oidb.OIDBSSOPkg{
Command: 1372,
ServiceType: 1,
Bodybuffer: binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt32(uint32(groupCode))
w.WriteUInt32(uint32(member))
w.WriteByte(func() byte {
if flag {
return 1
}
return 0
}())
}),
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0x55c_1", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}
// MultiMsg.ApplyUp
func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, groupUin int64) (uint16, []byte) {
seq := c.nextSeq()

View File

@ -803,6 +803,10 @@ func (c *QQClient) editMemberSpecialTitle(groupCode, memberUin int64, title stri
_, _ = c.sendAndWait(c.buildEditSpecialTitlePacket(groupCode, memberUin, title))
}
func (c *QQClient) setGroupAdmin(groupCode, memberUin int64, flag bool) {
_, _ = c.sendAndWait(c.buildGroupAdminSetPacket(groupCode, memberUin, flag))
}
func (c *QQClient) updateGroupName(groupCode int64, newName string) {
_, _ = c.sendAndWait(c.buildGroupNameUpdatePacket(groupCode, newName))
}

View File

@ -246,6 +246,12 @@ func (m *GroupMemberInfo) EditCard(card string) {
}
}
func (m *GroupMemberInfo) SetAdmin(flag bool) {
if m.Group.OwnerUin == m.Group.client.Uin {
m.Group.client.setGroupAdmin(m.Group.Code, m.Uin, flag)
}
}
func (m *GroupMemberInfo) EditSpecialTitle(title string) {
if m.Group.SelfPermission() == Owner && len(title) <= 18 {
m.Group.client.editMemberSpecialTitle(m.Group.Code, m.Uin, title)