diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a4beee..ccd5d3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: ['1.11', '1.12', '1.13', '1.14', '1.15'] + go-version: ['1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17'] steps: - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@v2 diff --git a/messenger.go b/messenger.go index 52d6a7f..bc23cba 100644 --- a/messenger.go +++ b/messenger.go @@ -374,7 +374,7 @@ func (m *Messenger) dispatch(r Receive) { } resp := &Response{ - to: Recipient{info.Sender.ID}, + to: Recipient{ID: info.Sender.ID}, token: m.token, sendAPIVersion: m.sendAPIVersion, } @@ -436,7 +436,7 @@ func (m *Messenger) dispatch(r Receive) { // Response returns new Response object. func (m *Messenger) Response(to int64) *Response { return &Response{ - to: Recipient{to}, + to: Recipient{ID: to}, token: m.token, sendAPIVersion: m.sendAPIVersion, } diff --git a/messenger_test.go b/messenger_test.go index 7633894..3166162 100644 --- a/messenger_test.go +++ b/messenger_test.go @@ -106,7 +106,7 @@ func TestMessenger_Dispatch(t *testing.T) { messages := []MessageInfo{ { Sender: Sender{111}, - Recipient: Recipient{222}, + Recipient: Recipient{ID: 222}, // 2018-11-24 21:31:51 UTC + 999ms Timestamp: 1543095111999, Message: &Message{}, @@ -138,7 +138,7 @@ func TestMessenger_Dispatch(t *testing.T) { messages := []MessageInfo{ { Sender: Sender{111}, - Recipient: Recipient{222}, + Recipient: Recipient{ID: 222}, // 2018-11-24 21:31:51 UTC + 999ms Timestamp: 1543095111999, Delivery: &Delivery{}, @@ -170,7 +170,7 @@ func TestMessenger_Dispatch(t *testing.T) { messages := []MessageInfo{ { Sender: Sender{111}, - Recipient: Recipient{222}, + Recipient: Recipient{ID: 222}, // 2018-11-24 21:31:51 UTC + 999ms Timestamp: 1543095111999, Read: &Read{}, @@ -205,7 +205,7 @@ func TestMessenger_Dispatch(t *testing.T) { messages := []MessageInfo{ { Sender: Sender{111}, - Recipient: Recipient{222}, + Recipient: Recipient{ID: 222}, // 2018-11-24 21:31:51 UTC + 999ms Timestamp: 1543095111999, PostBack: &PostBack{}, @@ -240,7 +240,7 @@ func TestMessenger_Dispatch(t *testing.T) { messages := []MessageInfo{ { Sender: Sender{111}, - Recipient: Recipient{222}, + Recipient: Recipient{ID: 222}, // 2018-11-24 21:31:51 UTC + 999ms Timestamp: 1543095111999, OptIn: &OptIn{}, @@ -275,7 +275,7 @@ func TestMessenger_Dispatch(t *testing.T) { messages := []MessageInfo{ { Sender: Sender{111}, - Recipient: Recipient{222}, + Recipient: Recipient{ID: 222}, // 2018-11-24 21:31:51 UTC + 999ms Timestamp: 1543095111999, ReferralMessage: &ReferralMessage{}, diff --git a/receiving.go b/receiving.go index f83d099..8d7a0c8 100644 --- a/receiving.go +++ b/receiving.go @@ -87,7 +87,9 @@ type Sender struct { // Recipient is who the message was sent to. type Recipient struct { - ID int64 `json:"id,string"` + ID int64 `json:"id,string,omitempty"` + PostID string `json:"post_id,omitempty"` + CommentID string `json:"comment_id,omitempty"` } // Attachment is a file which used in a message.