The new logbot, not committed from the wrong terminal window this time.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
519 B

package channels
import (
"context"
"time"
"git.aiterp.net/rpdata/logbot3/internal/models"
)
// SubscribeLogged returns a channel that gets all the channel changes.
func SubscribeLogged(ctx context.Context) (<-chan models.Channel, error) {
channels, err := ListLogged(ctx)
if err != nil {
return nil, err
}
output := make(chan models.Channel, len(channels)+8)
for _, channel := range channels {
output <- channel
}
go func() {
for {
time.Sleep(time.Second * 20)
}
}()
return output, nil
}