2017-07-02 13:11:42 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/fatih/color"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
color.Yellow("Refreshing osu information")
|
|
|
|
|
|
|
|
ticker := time.NewTicker(500 * time.Millisecond)
|
|
|
|
|
2017-10-18 16:18:15 +00:00
|
|
|
allUsers, _ := arn.AllUsers()
|
|
|
|
|
|
|
|
for _, user := range allUsers {
|
2017-07-02 13:11:42 +00:00
|
|
|
// Get osu info
|
|
|
|
if user.RefreshOsuInfo() == nil {
|
|
|
|
arn.PrettyPrint(user.Accounts.Osu)
|
2017-10-18 16:18:15 +00:00
|
|
|
|
|
|
|
// Fetch user again to prevent writing old data
|
|
|
|
updatedUser, _ := arn.GetUser(user.ID)
|
|
|
|
updatedUser.Accounts.Osu = user.Accounts.Osu
|
|
|
|
updatedUser.Save()
|
2017-07-02 13:11:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Wait for rate limiter
|
|
|
|
<-ticker.C
|
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("Finished.")
|
|
|
|
}
|