add pre group one bot setting
This commit is contained in:
@@ -2,6 +2,7 @@ package private
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"git.trj.tw/golang/mtfosbot/model"
|
||||
@@ -107,6 +108,11 @@ func UpdateFacebookPagePost(c *context.Context) {
|
||||
|
||||
for _, g := range page.Groups {
|
||||
if g.Notify {
|
||||
bot, err := g.GetBot()
|
||||
if err != nil || bot == nil {
|
||||
log.Println("get group binding bot fail ::: ", err)
|
||||
continue
|
||||
}
|
||||
tmpl := g.Tmpl
|
||||
if len(tmpl) > 0 {
|
||||
tmpl = strings.Replace(tmpl, "{link}", v.Link, -1)
|
||||
@@ -117,7 +123,7 @@ func UpdateFacebookPagePost(c *context.Context) {
|
||||
msg := line.TextMessage{
|
||||
Text: tmpl,
|
||||
}
|
||||
line.PushMessage(g.ID, msg)
|
||||
line.PushMessage(bot.AccessToken, g.ID, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,6 +175,11 @@ func UpdateInstagramPost(c *context.Context) {
|
||||
|
||||
for _, g := range ig.Groups {
|
||||
if g.Notify {
|
||||
bot, err := g.GetBot()
|
||||
if err != nil || bot == nil {
|
||||
log.Println("get group binding bot fail :: ", err)
|
||||
continue
|
||||
}
|
||||
tmpl := g.Tmpl
|
||||
if len(tmpl) > 0 {
|
||||
tmpl = strings.Replace(tmpl, "{link}", v.Link, -1)
|
||||
@@ -178,7 +189,7 @@ func UpdateInstagramPost(c *context.Context) {
|
||||
}
|
||||
|
||||
msg := line.TextMessage{Text: tmpl}
|
||||
line.PushMessage(g.ID, msg)
|
||||
line.PushMessage(bot.AccessToken, g.ID, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user