package web import ( "encoding/json" "fmt" "git.jojodev.com/Minecraft/go-mcm/internal" ) type Online struct { Query Query `json:"query"` } type Query struct { Max string `json:"max"` Online string `json:"online"` Players []string `json:"players"` } func (web *Web) Online() (*Online, error) { endpoint := fmt.Sprintf("%s?api=%s", web.endpoint("online"), web.Token) online := &Online{} resp, err := internal.ResponseGet(endpoint) if err != nil { return nil, err } err = json.Unmarshal(resp, &online) if err != nil { return nil, err } return online, nil }