loop UpdatesChan so it keeps getting updates

pull/1/head
Syfaro 10 years ago
parent a17651c8fe
commit 4acb279a67
  1. 2
      updates.go

@ -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