This commit is contained in:
Jay Chen 2019-06-25 20:56:52 +08:00
parent d6f4d8d0b1
commit 27274019da
3 changed files with 5 additions and 0 deletions

View File

@ -2,12 +2,14 @@ package linemsg
import ( import (
"fmt" "fmt"
"log"
lineobj "git.trj.tw/golang/mtfosbot/module/line-message/line-object" lineobj "git.trj.tw/golang/mtfosbot/module/line-message/line-object"
) )
// MessageEvent - // MessageEvent -
func MessageEvent(botid string, e *lineobj.EventObject) { func MessageEvent(botid string, e *lineobj.EventObject) {
log.Println("proc message evt :: ", botid, *e)
if len(botid) == 0 { if len(botid) == 0 {
return return
} }

View File

@ -17,6 +17,7 @@ import (
) )
func messageType(botid string, e *lineobj.EventObject) { func messageType(botid string, e *lineobj.EventObject) {
log.Println("proc msg type text :: ", botid)
msg := e.Message msg := e.Message
mtype, ok := msg["type"] mtype, ok := msg["type"]
if !ok { if !ok {

View File

@ -6,6 +6,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"log"
"git.trj.tw/golang/mtfosbot/model" "git.trj.tw/golang/mtfosbot/model"
"git.trj.tw/golang/mtfosbot/module/context" "git.trj.tw/golang/mtfosbot/module/context"
@ -100,6 +101,7 @@ func GetLineMessage(c *context.Context) {
if len(events.Events) > 0 { if len(events.Events) > 0 {
for _, v := range events.Events { for _, v := range events.Events {
log.Println("get line message :: ", v)
go linemsg.MessageEvent(botid, v) go linemsg.MessageEvent(botid, v)
} }
} }