31 lines
645 B
Go
31 lines
645 B
Go
|
package cron
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
|
||
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain"
|
||
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/services/input"
|
||
|
)
|
||
|
|
||
|
func (c *Cron) CheckFfxiv() {
|
||
|
sources, err := c.repo.Sources.ListBySource(*c.ctx, 0, 10, domain.SourceCollectorFfxiv)
|
||
|
if err != nil {
|
||
|
log.Printf("[FFXIV] No sources found to query - %v\r", err)
|
||
|
}
|
||
|
|
||
|
for _, source := range sources {
|
||
|
if !source.Enabled {
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
fc := input.NewFFXIVClient(source)
|
||
|
items, err := fc.CheckSource()
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
}
|
||
|
|
||
|
c.SaveNewArticles(items, domain.SourceCollectorFfxiv)
|
||
|
}
|
||
|
log.Printf("[FFXIV Done!]")
|
||
|
}
|