// mautrix-groupme - A Matrix-GroupMe puppeting bridge. // Copyright (C) 2022 Sumner Evans, Karmanyaah Malhotra // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . package whatsappExt import ( "github.com/karmanyaahm/matrix-groupme-go/types" ) type CreateGroupResponse struct { Status int `json:"status"` GroupID types.GroupMeID `json:"gid"` Participants map[types.GroupMeID]struct { Code string `json:"code"` } `json:"participants"` Source string `json:"-"` } type actualCreateGroupResponse struct { Status int `json:"status"` GroupID types.GroupMeID `json:"gid"` Participants []map[types.GroupMeID]struct { Code string `json:"code"` } `json:"participants"` } func (ext *ExtendedConn) CreateGroup(subject string, participants []types.GroupMeID) (*CreateGroupResponse, error) { // respChan, err := ext.Conn.CreateGroup(subject, participants) // if err != nil { // return nil, err // } // var resp CreateGroupResponse // var actualResp actualCreateGroupResponse // resp.Source = <-respChan // fmt.Println(">>>>>>", resp.Source) // err = json.Unmarshal([]byte(resp.Source), &actualResp) // if err != nil { // return nil, err // } // resp.Status = actualResp.Status // resp.GroupID = actualResp.GroupID // resp.Participants = make(map[types.GroupMeID]struct { // Code string `json:"code"` // }) // for _, participantMap := range actualResp.Participants { // for jid, status := range participantMap { // resp.Participants[jid] = status // } // } // return &resp, nil return nil, nil }