package channels import ( "context" "encoding/json" "git.aiterp.net/rpdata/logbot3/internal/api" "git.aiterp.net/rpdata/logbot3/internal/models" ) type listLoggedResult struct { Channels []models.Channel `json:"channels"` } var listLoggedGQL = ` query ListLogged { channels(filter: {logged: true}) { name logged eventName locationName } } ` // ListLogged gets all open channels func ListLogged(ctx context.Context) ([]models.Channel, error) { data, err := api.Global().Query(ctx, listLoggedGQL, nil, nil) if err != nil { return nil, err } result := listLoggedResult{} err = json.Unmarshal(data, &result) if err != nil { return nil, err } return result.Channels, nil }