diff --git a/.gitignore b/.gitignore index eeb4ab3..8d23f5a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ config.yml .idea module/schema/static.go*.swp module/schema/static.go +*.swp diff --git a/router/google/youtube.go b/router/google/youtube.go index b94b742..2e77247 100644 --- a/router/google/youtube.go +++ b/router/google/youtube.go @@ -4,12 +4,14 @@ import ( "encoding/xml" "fmt" "io/ioutil" + "log" "strings" "time" "git.trj.tw/golang/mtfosbot/model" lineapi "git.trj.tw/golang/mtfosbot/module/apis/line" "git.trj.tw/golang/mtfosbot/module/context" + "git.trj.tw/golang/mtfosbot/module/utils" ) type feed struct { @@ -91,12 +93,15 @@ func GetNotifyWebhook(c *context.Context) { return } + log.Println("hook data", utils.ToMap(hook)) + if len(hook.Entry) == 0 { c.Success(nil) return } yt, err := model.GetYoutubeChannelWithID(id) + log.Println("youtube and error", yt, err) if err != nil || yt == nil { c.ServerError(nil) return @@ -113,6 +118,13 @@ func GetNotifyWebhook(c *context.Context) { return } + err = yt.GetGroups() + if err != nil { + log.Println("get groups error ::::", err) + c.ServerError(nil) + return + } + for _, v := range yt.Groups { if v.Notify { str := v.Tmpl