From d13ea008d58acd7527084256926eb99541cb6166 Mon Sep 17 00:00:00 2001 From: nanato12 <admin@nanato12.info> Date: Tue, 17 May 2022 19:21:47 +0900 Subject: [PATCH 1/5] update: action.go --- linebot/actions.go | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/linebot/actions.go b/linebot/actions.go index c9658196..20098850 100644 --- a/linebot/actions.go +++ b/linebot/actions.go @@ -30,6 +30,17 @@ const ( ActionTypeLocation ActionType = "location" ) +// InputOption type +type InputOption string + +// InputOption constants +const ( + InputOptionCloseRichMenu InputOption = "closeRichMenu" + InputOptionOpenRichMenu InputOption = "openRichMenu" + InputOptionOpenKeyboard InputOption = "openKeyboard" + InputOptionOpenVoice InputOption = "openVoice" +) + // Action interface type Action interface { json.Marshaler @@ -99,22 +110,28 @@ type PostbackAction struct { Data string Text string DisplayText string + InputOption InputOption + FillInText string } // MarshalJSON method of PostbackAction func (a *PostbackAction) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Type ActionType `json:"type"` - Label string `json:"label,omitempty"` - Data string `json:"data"` - Text string `json:"text,omitempty"` - DisplayText string `json:"displayText,omitempty"` + Label string `json:"label,omitempty"` + Data string `json:"data"` + Text string `json:"text,omitempty"` + DisplayText string `json:"displayText,omitempty"` + InputOption InputOption `json:"inputOption,omitempty"` + FillInText string `json:"fillInText,omitempty"` }{ Type: ActionTypePostback, Label: a.Label, Data: a.Data, Text: a.Text, DisplayText: a.DisplayText, + InputOption: a.InputOption, + FillInText: a.FillInText, }) } @@ -247,12 +264,14 @@ func NewMessageAction(label, text string) *MessageAction { } // NewPostbackAction function -func NewPostbackAction(label, data, text, displayText string) *PostbackAction { +func NewPostbackAction(label, data, text, displayText string, inputOption InputOption, fillInText string) *PostbackAction { return &PostbackAction{ Label: label, Data: data, Text: text, DisplayText: displayText, + InputOption: inputOption, + FillInText: fillInText, } } From 221e7934cdbbf9435a0c8c8dfc1bc8b44d1b61f5 Mon Sep 17 00:00:00 2001 From: nanato12 <admin@nanato12.info> Date: Tue, 17 May 2022 19:22:00 +0900 Subject: [PATCH 2/5] update: TestMessageTypes --- linebot/message_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linebot/message_test.go b/linebot/message_test.go index b9b73f96..93055d3b 100644 --- a/linebot/message_test.go +++ b/linebot/message_test.go @@ -71,7 +71,7 @@ func TestMessageTypes(t *testing.T) { "https://example.com/bot/images/image.jpg", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), ), ), Want: want{ From 418c0dab23b5765b54456058fb95631923f0b3bb Mon Sep 17 00:00:00 2001 From: nanato12 <admin@nanato12.info> Date: Tue, 17 May 2022 19:22:13 +0900 Subject: [PATCH 3/5] update: TestPushMessages --- linebot/send_message_test.go | 85 ++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/linebot/send_message_test.go b/linebot/send_message_test.go index 872618a7..6ef54dbc 100644 --- a/linebot/send_message_test.go +++ b/linebot/send_message_test.go @@ -108,8 +108,10 @@ func TestPushMessages(t *testing.T) { "https://example.com/bot/images/image.jpg", "Menu", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionCloseRichMenu, ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -117,7 +119,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","thumbnailImageUrl":"https://example.com/bot/images/image.jpg","title":"Menu","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","thumbnailImageUrl":"https://example.com/bot/images/image.jpg","title":"Menu","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"closeRichMenu"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -152,8 +154,10 @@ func TestPushMessages(t *testing.T) { "", "Menu", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenRichMenu, ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -161,7 +165,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","title":"Menu","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","title":"Menu","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openRichMenu"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -174,8 +178,10 @@ func TestPushMessages(t *testing.T) { "https://example.com/bot/images/image.jpg", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenVoice, ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -183,7 +189,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","thumbnailImageUrl":"https://example.com/bot/images/image.jpg","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","thumbnailImageUrl":"https://example.com/bot/images/image.jpg","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openVoice"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -196,8 +202,10 @@ func TestPushMessages(t *testing.T) { "https://example.com/bot/images/image.jpg", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), NewURIAction("View detail", "https://example.com/page/123"), ).WithImageOptions("rectangle", "cover", "#FFFFFF"), ), @@ -205,7 +213,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","thumbnailImageUrl":"https://example.com/bot/images/image.jpg","imageAspectRatio":"rectangle","imageSize":"cover","imageBackgroundColor":"#FFFFFF","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","thumbnailImageUrl":"https://example.com/bot/images/image.jpg","imageAspectRatio":"rectangle","imageSize":"cover","imageBackgroundColor":"#FFFFFF","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -218,8 +226,9 @@ func TestPushMessages(t *testing.T) { "", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -227,7 +236,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a buttons template","template":{"type":"buttons","text":"Please select","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","displayText":"displayText"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","text":"text"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/123"}]}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -260,9 +269,10 @@ func TestPushMessages(t *testing.T) { "https://example.com/bot/images/item1.jpg", "this is menu", "description", - NewPostbackAction("Buy", "action=buy&itemid=111", "", ""), - NewPostbackAction("Add to cart", "action=add&itemid=111", "", ""), - NewURIAction("View detail", "https://example.com/page/111"), + NewPostbackAction("Buy", "action=buy&itemid=111", "", "", "", ""), + NewPostbackAction("Add to cart", "action=add&itemid=111", "", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), + NewURIAction("View detail", "https://example.com/page/111"), ), ), ), @@ -270,7 +280,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a carousel template","template":{"type":"carousel","columns":[{"thumbnailImageUrl":"https://example.com/bot/images/item1.jpg","title":"this is menu","text":"description","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=111"},{"type":"postback","label":"Add to cart","data":"action=add\u0026itemid=111"},{"type":"uri","label":"View detail","uri":"https://example.com/page/111"}]}]}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a carousel template","template":{"type":"carousel","columns":[{"thumbnailImageUrl":"https://example.com/bot/images/item1.jpg","title":"this is menu","text":"description","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=111"},{"type":"postback","label":"Add to cart","data":"action=add\u0026itemid=111"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/111"}]}]}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -284,9 +294,10 @@ func TestPushMessages(t *testing.T) { "https://example.com/bot/images/item1.jpg", "this is menu", "description", - NewPostbackAction("Buy", "action=buy&itemid=111", "", ""), - NewPostbackAction("Add to cart", "action=add&itemid=111", "", ""), - NewURIAction("View detail", "https://example.com/page/111"), + NewPostbackAction("Buy", "action=buy&itemid=111", "", "", "", ""), + NewPostbackAction("Add to cart", "action=add&itemid=111", "", "", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "", InputOptionOpenKeyboard, "text"), + NewURIAction("View detail", "https://example.com/page/111"), ).WithImageOptions("#FFFFFF"), ).WithImageOptions("rectangle", "cover"), ), @@ -294,7 +305,7 @@ func TestPushMessages(t *testing.T) { ResponseCode: 200, Response: []byte(`{}`), Want: want{ - RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a carousel template with imageAspectRatio, imageSize and imageBackgroundColor","template":{"type":"carousel","columns":[{"thumbnailImageUrl":"https://example.com/bot/images/item1.jpg","imageBackgroundColor":"#FFFFFF","title":"this is menu","text":"description","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=111"},{"type":"postback","label":"Add to cart","data":"action=add\u0026itemid=111"},{"type":"uri","label":"View detail","uri":"https://example.com/page/111"}]}],"imageAspectRatio":"rectangle","imageSize":"cover"}}]}` + "\n"), + RequestBody: []byte(`{"to":"U0cc15697597f61dd8b01cea8b027050e","messages":[{"type":"template","altText":"this is a carousel template with imageAspectRatio, imageSize and imageBackgroundColor","template":{"type":"carousel","columns":[{"thumbnailImageUrl":"https://example.com/bot/images/item1.jpg","imageBackgroundColor":"#FFFFFF","title":"this is menu","text":"description","actions":[{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=111"},{"type":"postback","label":"Add to cart","data":"action=add\u0026itemid=111"},{"type":"postback","label":"Buy","data":"action=buy\u0026itemid=123","inputOption":"openKeyboard","fillInText":"text"},{"type":"uri","label":"View detail","uri":"https://example.com/page/111"}]}],"imageAspectRatio":"rectangle","imageSize":"cover"}}]}` + "\n"), Response: &BasicResponse{}, }, }, @@ -970,8 +981,8 @@ func TestBroadcastMessages(t *testing.T) { "https://example.com/bot/images/image.jpg", "Menu", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -1014,8 +1025,8 @@ func TestBroadcastMessages(t *testing.T) { "", "Menu", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -1036,8 +1047,8 @@ func TestBroadcastMessages(t *testing.T) { "https://example.com/bot/images/image.jpg", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -1058,8 +1069,8 @@ func TestBroadcastMessages(t *testing.T) { "https://example.com/bot/images/image.jpg", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), NewURIAction("View detail", "https://example.com/page/123"), ).WithImageOptions( "rectangle", @@ -1086,8 +1097,8 @@ func TestBroadcastMessages(t *testing.T) { "", "", "Please select", - NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText"), - NewPostbackAction("Buy", "action=buy&itemid=123", "text", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "", "displayText", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=123", "text", "", "", ""), NewURIAction("View detail", "https://example.com/page/123"), ), ), @@ -1128,8 +1139,8 @@ func TestBroadcastMessages(t *testing.T) { "https://example.com/bot/images/item1.jpg", "this is menu", "description", - NewPostbackAction("Buy", "action=buy&itemid=111", "", ""), - NewPostbackAction("Add to cart", "action=add&itemid=111", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=111", "", "", "", ""), + NewPostbackAction("Add to cart", "action=add&itemid=111", "", "", "", ""), NewURIAction("View detail", "https://example.com/page/111"), ), ), @@ -1152,8 +1163,8 @@ func TestBroadcastMessages(t *testing.T) { "https://example.com/bot/images/item1.jpg", "this is menu", "description", - NewPostbackAction("Buy", "action=buy&itemid=111", "", ""), - NewPostbackAction("Add to cart", "action=add&itemid=111", "", ""), + NewPostbackAction("Buy", "action=buy&itemid=111", "", "", "", ""), + NewPostbackAction("Add to cart", "action=add&itemid=111", "", "", "", ""), NewURIAction("View detail", "https://example.com/page/111"), ).WithImageOptions( "#FFFFFF", From 1aafd15c8750ac621486e045cb338f94ae549056 Mon Sep 17 00:00:00 2001 From: nanato12 <admin@nanato12.info> Date: Tue, 17 May 2022 19:23:08 +0900 Subject: [PATCH 4/5] update: example kitchensink --- examples/kitchensink/server.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/kitchensink/server.go b/examples/kitchensink/server.go index 7a643675..f019eed8 100644 --- a/examples/kitchensink/server.go +++ b/examples/kitchensink/server.go @@ -187,8 +187,8 @@ func (app *KitchenSink) handleText(message *linebot.TextMessage, replyToken stri template := linebot.NewButtonsTemplate( imageURL, "My button sample", "Hello, my button", linebot.NewURIAction("Go to line.me", "https://line.me"), - linebot.NewPostbackAction("Say hello1", "hello こんにちは", "", "hello こんにちは"), - linebot.NewPostbackAction("言 hello2", "hello こんにちは", "hello こんにちは", ""), + linebot.NewPostbackAction("Say hello1", "hello こんにちは", "", "hello こんにちは", "", ""), + linebot.NewPostbackAction("言 hello2", "hello こんにちは", "hello こんにちは", "", "", ""), linebot.NewMessageAction("Say message", "Rice=米"), ) if _, err := app.bot.ReplyMessage( @@ -215,11 +215,11 @@ func (app *KitchenSink) handleText(message *linebot.TextMessage, replyToken stri linebot.NewCarouselColumn( imageURL, "hoge", "fuga", linebot.NewURIAction("Go to line.me", "https://line.me"), - linebot.NewPostbackAction("Say hello1", "hello こんにちは", "", ""), + linebot.NewPostbackAction("Say hello1", "hello こんにちは", "", "", "", ""), ), linebot.NewCarouselColumn( imageURL, "hoge", "fuga", - linebot.NewPostbackAction("言 hello2", "hello こんにちは", "hello こんにちは", ""), + linebot.NewPostbackAction("言 hello2", "hello こんにちは", "hello こんにちは", "", "", ""), linebot.NewMessageAction("Say message", "Rice=米"), ), ) @@ -238,7 +238,7 @@ func (app *KitchenSink) handleText(message *linebot.TextMessage, replyToken stri ), linebot.NewImageCarouselColumn( imageURL, - linebot.NewPostbackAction("Say hello1", "hello こんにちは", "", ""), + linebot.NewPostbackAction("Say hello1", "hello こんにちは", "", "", "", ""), ), linebot.NewImageCarouselColumn( imageURL, From 19a22a8ae75d8816517cb5421c3c3b069d63dce3 Mon Sep 17 00:00:00 2001 From: nanato12 <admin@nanato12.info> Date: Tue, 17 May 2022 19:32:14 +0900 Subject: [PATCH 5/5] update: action.go --- linebot/actions.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linebot/actions.go b/linebot/actions.go index 20098850..184280fa 100644 --- a/linebot/actions.go +++ b/linebot/actions.go @@ -35,10 +35,10 @@ type InputOption string // InputOption constants const ( - InputOptionCloseRichMenu InputOption = "closeRichMenu" - InputOptionOpenRichMenu InputOption = "openRichMenu" - InputOptionOpenKeyboard InputOption = "openKeyboard" - InputOptionOpenVoice InputOption = "openVoice" + InputOptionCloseRichMenu InputOption = "closeRichMenu" + InputOptionOpenRichMenu InputOption = "openRichMenu" + InputOptionOpenKeyboard InputOption = "openKeyboard" + InputOptionOpenVoice InputOption = "openVoice" ) // Action interface