21 lines
601 B
Go
21 lines
601 B
Go
package main
|
|
|
|
import "github.com/line/line-bot-sdk-go/v7/linebot"
|
|
|
|
func ApiMyOrders(event *linebot.Event) {
|
|
var orders []Order
|
|
DB.Find(&orders, "user_id = ?", event.Source.UserID)
|
|
|
|
if len(orders) == 0 {
|
|
leftBtn := linebot.NewMessageAction("left", "left clicked")
|
|
rightBtn := linebot.NewMessageAction("right", "right clicked")
|
|
template := linebot.NewConfirmTemplate("Hello World", leftBtn, rightBtn)
|
|
|
|
msg := linebot.NewTemplateMessage("Sorry :(, please update your app.", template)
|
|
|
|
if _, err := SendMessage(event.ReplyToken, event.Source.UserID, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
}
|