modify notify stream rule

This commit is contained in:
Jay 2018-11-29 14:19:23 +08:00
parent ac1dcb7827
commit 1529e2ea50

View File

@ -3,6 +3,7 @@ package background
import ( import (
"fmt" "fmt"
"strings" "strings"
"time"
"git.trj.tw/golang/mtfosbot/model" "git.trj.tw/golang/mtfosbot/model"
"git.trj.tw/golang/mtfosbot/module/apis/line" "git.trj.tw/golang/mtfosbot/module/apis/line"
@ -45,6 +46,10 @@ func checkStream(ch *model.TwitchChannel, info *twitch.StreamInfo) {
return return
} }
// 開台間隔小於10分鐘不通知
if time.Now().Unix()-ch.Mtime.Unix() < 600 {
return
}
link := fmt.Sprintf("https://twitch.tv/%s", ch.Name) link := fmt.Sprintf("https://twitch.tv/%s", ch.Name)
for _, v := range ch.Groups { for _, v := range ch.Groups {
if v.Notify { if v.Notify {