41 lines
599 B
Go
Raw Normal View History

2017-07-02 13:11:42 +00:00
package main
import (
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
2018-03-21 04:15:03 +00:00
var ticker = time.NewTicker(500 * time.Millisecond)
2017-07-02 13:11:42 +00:00
func main() {
color.Yellow("Refreshing osu information")
2018-03-21 04:15:03 +00:00
defer color.Green("Finished.")
defer arn.Node.Close()
2017-07-02 13:11:42 +00:00
2017-11-02 08:26:05 +00:00
for user := range arn.StreamUsers() {
2018-03-21 04:15:03 +00:00
if user.Accounts.Osu.Nick == "" {
continue
2017-07-02 13:11:42 +00:00
}
2018-03-21 04:15:03 +00:00
// Fetch new info
err := user.RefreshOsuInfo()
if err != nil {
color.Red(err.Error())
continue
}
// Log it
arn.PrettyPrint(user.Accounts.Osu)
// Save in database
user.Save()
2017-07-02 13:11:42 +00:00
// Wait for rate limiter
<-ticker.C
}
}