modify youtube webhook
This commit is contained in:
parent
99c61b5af1
commit
9bbd17a39b
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ config.yml
|
||||
.idea
|
||||
module/schema/static.go*.swp
|
||||
module/schema/static.go
|
||||
*.swp
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user