mtfosbot/module/background/youtube.go

21 lines
369 B
Go
Raw Permalink Normal View History

2018-09-17 06:30:49 +00:00
package background
import (
"time"
"git.trj.tw/golang/mtfosbot/model"
googleapis "git.trj.tw/golang/mtfosbot/module/apis/google"
)
func checkYoutubeSubscribe() {
e := time.Now().Unix() + (4 * 60 * 60)
yt, err := model.GetYoutubeChannelsWithExpire(e)
if err != nil || len(yt) == 0 {
return
}
for _, v := range yt {
googleapis.SubscribeYoutube(v.ID)
}
}