1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-10 17:12:48 +00:00

fix pubg error handling

This commit is contained in:
2017-08-17 16:08:06 -05:00
parent 630efd421e
commit 6f89c7ce00

View File

@@ -28,13 +28,22 @@ func Start(key string, players []string) {
func fetchStats(players []string) {
api := pubgClient.New(apiKey)
api, err := pubgClient.New(apiKey)
if err != nil {
log.Fatal(err)
}
// fetch new stats every 30 seconds
for {
for _, player := range players {
newStats := api.GetPlayer(player)
newStats, err := api.GetPlayer(player)
if err != nil {
log.Println(err)
continue
}
mut.Lock()
stats[player] = newStats