slight code improvments, better language

bot-api-6.1
Syfaro 2015-06-29 22:44:12 -05:00
parent 7473250643
commit 2024a55b87
1 changed files with 10 additions and 8 deletions

View File

@ -13,14 +13,17 @@ func (bot *BotAPI) UpdatesChan(config UpdateConfig) (chan Update, error) {
for { for {
updates, err := bot.GetUpdates(config) updates, err := bot.GetUpdates(config)
if err != nil { if err != nil {
if bot.Debug == true { if bot.Debug {
panic(err) panic(err)
} else { } else {
log.Println(err) log.Println(err)
log.Println("Fail to GetUpdates,Retry in 3 Seconds...") log.Println("Failed to get updates, retrying in 3 seconds...")
time.Sleep(time.Second * 3) time.Sleep(time.Second * 3)
} }
} else {
continue
}
for _, update := range updates { for _, update := range updates {
if update.UpdateID >= config.Offset { if update.UpdateID >= config.Offset {
config.Offset = update.UpdateID + 1 config.Offset = update.UpdateID + 1
@ -28,7 +31,6 @@ func (bot *BotAPI) UpdatesChan(config UpdateConfig) (chan Update, error) {
} }
} }
} }
}
}() }()
return bot.Updates, nil return bot.Updates, nil