package cron import ( "log" "git.jamestombleson.com/jtom38/newsbot-api/internal/domain" "git.jamestombleson.com/jtom38/newsbot-api/internal/services/input" ) func (c *Cron) CheckTwitch() error { sources, err := c.repo.Sources.ListBySource(*c.ctx, 0, 100, domain.SourceCollectorTwitch) if err != nil { log.Printf("[Twitch] No sources found to query - %v\r", err) } tc, err := input.NewTwitchClient() if err != nil { return err } err = tc.Login() if err != nil { return err } for _, source := range sources { if !source.Enabled { continue } log.Printf("[Twitch] Checking '%v'...", source.DisplayName) tc.ReplaceSourceRecord(source) items, err := tc.GetContent() if err != nil { log.Println(err) } c.SaveNewArticles(items, domain.SourceCollectorTwitch) } log.Print("[Twitch] Done!") return nil }