add pre group one bot setting

This commit is contained in:
Jay
2019-06-25 17:02:03 +08:00
parent c605b2d9e9
commit 8c432b9b68
13 changed files with 185 additions and 56 deletions
+10 -3
View File
@@ -1,6 +1,7 @@
package msgcmd
import (
"fmt"
"regexp"
"strings"
@@ -22,10 +23,15 @@ func parseCMD(in string) (c [][]string) {
}
// ParseLineMsg -
func ParseLineMsg(txt, replyToken string, source *lineobj.SourceObject) {
func ParseLineMsg(botid, txt, replyToken string, source *lineobj.SourceObject) {
if source.Type != "group" {
return
}
bot, err := model.GetBotInfo(botid)
if err != nil || bot == nil {
fmt.Println("get bot err or no bot :: ", err)
return
}
strs := strings.Split(strings.Trim(txt, " "), " ")
// skip empty string
@@ -57,7 +63,7 @@ func ParseLineMsg(txt, replyToken string, source *lineobj.SourceObject) {
m := parseResult(v)
msgs = append(msgs, m)
}
line.ReplyMessage(replyToken, msgs...)
line.ReplyMessage(bot.AccessToken, replyToken, msgs...)
} else {
// key cmd
@@ -72,7 +78,8 @@ func ParseLineMsg(txt, replyToken string, source *lineobj.SourceObject) {
m := parseResult(v)
msgs = append(msgs, m)
}
line.ReplyMessage(replyToken, msgs...)
line.ReplyMessage(bot.AccessToken, replyToken, msgs...)
}
}