loop UpdatesChan so it keeps getting updates

bot-api-6.1
Syfaro 2015-06-26 02:12:09 -05:00
parent a17651c8fe
commit 4acb279a67
1 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,7 @@ func (bot *BotAPI) UpdatesChan(config UpdateConfig) (chan Update, error) {
bot.Updates = make(chan Update, 100) bot.Updates = make(chan Update, 100)
go func() { go func() {
for {
updates, err := bot.GetUpdates(config) updates, err := bot.GetUpdates(config)
if err != nil { if err != nil {
panic(err) panic(err)
@ -17,6 +18,7 @@ func (bot *BotAPI) UpdatesChan(config UpdateConfig) (chan Update, error) {
bot.Updates <- update bot.Updates <- update
} }
}
}() }()
return bot.Updates, nil return bot.Updates, nil