From b984d441245929116eb3290f3df49efa171d7e4a Mon Sep 17 00:00:00 2001 From: Albert Le Batteux Date: Tue, 1 Jan 2019 22:11:47 +0100 Subject: [PATCH 1/3] add: go module for go 1.11 --- go.mod | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..11f974d --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module github.com/paked/messenger + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.2.2 +) From 34e47adaff73316e4d5428b532797d34be58ace7 Mon Sep 17 00:00:00 2001 From: Albert Le Batteux Date: Tue, 1 Jan 2019 22:13:23 +0100 Subject: [PATCH 2/3] fix: omitempty item_url --- response.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/response.go b/response.go index 4411761..d5a8e27 100644 --- a/response.go +++ b/response.go @@ -368,7 +368,7 @@ type StructuredMessagePayload struct { type StructuredMessageElement struct { Title string `json:"title"` ImageURL string `json:"image_url"` - ItemURL string `json:"item_url"` + ItemURL string `json:"item_url,omitempty"` Subtitle string `json:"subtitle"` DefaultAction *DefaultAction `json:"default_action,omitempty"` Buttons []StructuredMessageButton `json:"buttons"` From 142c3f5add7120dcbbd43a1bd781c1016f408620 Mon Sep 17 00:00:00 2001 From: Albert Le Batteux Date: Tue, 1 Jan 2019 22:26:58 +0100 Subject: [PATCH 3/3] add: setter token for response struct --- response.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/response.go b/response.go index d5a8e27..20e243c 100644 --- a/response.go +++ b/response.go @@ -87,6 +87,11 @@ type Response struct { to Recipient } +// SetToken is for using DispatchMessage from outside. +func (r *Response) SetToken(token string) { + r.token = token +} + // Text sends a textual message. func (r *Response) Text(message string, messagingType MessagingType, tags ...string) error { return r.TextWithReplies(message, nil, messagingType, tags...)