package main import "github.com/line/line-bot-sdk-go/v7/linebot" func ApiMe(event *linebot.Event) { leftBtn := linebot.NewMessageAction("修改資料", "修改資料") rightBtn := linebot.NewMessageAction("我的保單", "我的保單") template := linebot.NewConfirmTemplate("請問想辦理甚麼服務?", leftBtn, rightBtn) msg := linebot.NewTemplateMessage("電腦版不支援此訊息, 請至手機上讀取", template) if _, err := SendMessage(event.ReplyToken, event.Source.UserID, msg); err != nil { panic(err) } } func ApiMyOrders(event *linebot.Event) { var orders []Order DB.Find(&orders, "user_id = ?", event.Source.UserID) if len(orders) == 0 { msg := linebot.NewTextMessage("您目前沒有保單, 歡迎前往「我要投保」專區選取保單。") if _, err := SendMessage(event.ReplyToken, event.Source.UserID, msg); err != nil { panic(err) } } }