package matrix import ( "fmt" "gopkg.in/h2non/gentleman.v2" "gopkg.in/h2non/gentleman.v2/plugins/query" ) func join(authinfo Authinfo, roomIdentifier string) error { cli := gentleman.New() cli.URL(authinfo.HomeServer) req := cli.Request() req.Path(fmt.Sprintf("/_matrix/client/r0/rooms/%s/join", roomIdentifier)) req.Method("POST") req.Use(query.Set("access_token", authinfo.AccessToken)) res, err := req.Send() if err != nil { fmt.Println("ERR1") return err } if !res.Ok { fmt.Println("ERR2") fmt.Println(res) return err } return nil }