github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/client/packets/oidb/FetchGroups.go (about) 1 package oidb 2 3 import ( 4 "github.com/LagrangeDev/LagrangeGo/client/entity" 5 "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb" 6 ) 7 8 func BuildFetchGroupsReq() (*OidbPacket, error) { 9 body := &oidb.OidbSvcTrpcTcp0XFE5_2{ 10 Config: &oidb.OidbSvcTrpcTcp0XFE5_2Config{ 11 Config1: &oidb.OidbSvcTrpcTcp0XFE5_2Config1{ 12 GroupOwner: true, Field2: true, MemberMax: true, MemberCount: true, GroupName: true, Field8: true, 13 Field9: true, Field10: true, Field11: true, Field12: true, Field13: true, Field14: true, Field15: true, 14 Field16: true, Field17: true, Field18: true, Question: true, Field20: true, Field22: true, Field23: true, 15 Field24: true, Field25: true, Field26: true, Field27: true, Field28: true, Field29: true, Field30: true, 16 Field31: true, Field32: true, Field5001: true, Field5002: true, Field5003: true, 17 }, 18 Config2: &oidb.OidbSvcTrpcTcp0XFE5_2Config2{ 19 Field1: true, Field2: true, Field3: true, Field4: true, Field5: true, Field6: true, Field7: true, 20 Field8: true, 21 }, 22 Config3: &oidb.OidbSvcTrpcTcp0XFE5_2Config3{ 23 Field5: true, Field6: true, 24 }, 25 }, 26 } 27 return BuildOidbPacket(0xFE5, 2, body, false, true) 28 } 29 30 func ParseFetchGroupsResp(data []byte) ([]*entity.Group, error) { 31 var resp oidb.OidbSvcTrpcTcp0XFE5_2Response 32 if _, err := ParseOidbPacket(data, &resp); err != nil { 33 return nil, err 34 } 35 groups := make([]*entity.Group, len(resp.Groups)) 36 for i, group := range resp.Groups { 37 groups[i] = &entity.Group{ 38 GroupUin: group.GroupUin, 39 GroupName: group.Info.GroupName, 40 MemberCount: group.Info.MemberCount, 41 MaxMember: group.Info.MemberMax, 42 } 43 } 44 return groups, nil 45 }