34 lines
620 B
Go
Raw Normal View History

2018-11-01 03:28:45 +00:00
package main
import (
"fmt"
"time"
2019-04-23 05:52:55 +00:00
"github.com/akyoto/color"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/arn/stringutils"
2018-11-01 03:28:45 +00:00
)
var tickerFFXIV = time.NewTicker(1100 * time.Millisecond)
func ffxiv(user *arn.User) {
fmt.Println("[FFXIV]", user.Nick, user.Accounts.FinalFantasyXIV.Nick, user.Accounts.FinalFantasyXIV.Server)
// Fetch new info
err := user.RefreshFFXIVInfo()
if err != nil {
color.Red(err.Error())
return
}
// Log it
stringutils.PrettyPrint(user.Accounts.FinalFantasyXIV)
// Save in database
user.Save()
// Wait for rate limiter
<-tickerFFXIV.C
}