1
bot/wait_updates.go

21 lines
305 B
Go
Raw Permalink Normal View History

2022-04-26 00:02:51 +08:00
package bot
import (
"context"
"sync"
2022-04-26 00:02:51 +08:00
)
// waitUpdates listen Updates channel and run ProcessUpdate
func (b *Bot) waitUpdates(ctx context.Context, wg *sync.WaitGroup) {
defer wg.Done()
2022-04-26 00:02:51 +08:00
for {
select {
case <-ctx.Done():
return
case upd := <-b.updates:
b.ProcessUpdate(ctx, upd)
2022-04-26 00:02:51 +08:00
}
}
}