add pre group one bot setting
This commit is contained in:
@@ -2,6 +2,7 @@ package background
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"sort"
|
||||
@@ -138,6 +139,11 @@ func getPageHTML(page *model.FacebookPage) {
|
||||
|
||||
for _, v := range page.Groups {
|
||||
if v.Notify {
|
||||
bot, err := v.GetBot()
|
||||
if err != nil || bot == nil {
|
||||
log.Println("get group binding bot fail :: ", err)
|
||||
continue
|
||||
}
|
||||
tmpl := v.Tmpl
|
||||
if len(tmpl) > 0 {
|
||||
tmpl = strings.Replace(tmpl, "{link}", lastData.Link, -1)
|
||||
@@ -148,7 +154,7 @@ func getPageHTML(page *model.FacebookPage) {
|
||||
msg := line.TextMessage{
|
||||
Text: tmpl,
|
||||
}
|
||||
line.PushMessage(v.ID, msg)
|
||||
line.PushMessage(bot.AccessToken, v.ID, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package background
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -61,6 +62,11 @@ func checkStream(ch *model.TwitchChannel, info *twitch.StreamInfo) {
|
||||
link := fmt.Sprintf("https://twitch.tv/%s", ch.Name)
|
||||
for _, v := range ch.Groups {
|
||||
if v.Notify {
|
||||
bot, err := v.GetBot()
|
||||
if err != nil || bot == nil {
|
||||
log.Println("get group binding bot fail :: ", err)
|
||||
continue
|
||||
}
|
||||
tmpl := v.Tmpl
|
||||
if len(tmpl) > 0 {
|
||||
tmpl = strings.Replace(tmpl, "{txt}", info.Title, -1)
|
||||
@@ -71,7 +77,7 @@ func checkStream(ch *model.TwitchChannel, info *twitch.StreamInfo) {
|
||||
msg := line.TextMessage{
|
||||
Text: tmpl,
|
||||
}
|
||||
line.PushMessage(v.ID, msg)
|
||||
line.PushMessage(bot.AccessToken, v.ID, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user