The new logbot, not committed from the wrong terminal window this time.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
710 B

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
}