1
0
mirror of synced 2024-11-24 05:46:07 +03:00

update recipient (#8)

This commit is contained in:
Pavel 2021-08-24 10:13:05 +03:00 committed by GitHub
parent 3033380a29
commit ec6ddfd1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 10 deletions

View File

@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: 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: steps:
- name: Set up Go ${{ matrix.go-version }} - name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2 uses: actions/setup-go@v2

View File

@ -374,7 +374,7 @@ func (m *Messenger) dispatch(r Receive) {
} }
resp := &Response{ resp := &Response{
to: Recipient{info.Sender.ID}, to: Recipient{ID: info.Sender.ID},
token: m.token, token: m.token,
sendAPIVersion: m.sendAPIVersion, sendAPIVersion: m.sendAPIVersion,
} }
@ -436,7 +436,7 @@ func (m *Messenger) dispatch(r Receive) {
// Response returns new Response object. // Response returns new Response object.
func (m *Messenger) Response(to int64) *Response { func (m *Messenger) Response(to int64) *Response {
return &Response{ return &Response{
to: Recipient{to}, to: Recipient{ID: to},
token: m.token, token: m.token,
sendAPIVersion: m.sendAPIVersion, sendAPIVersion: m.sendAPIVersion,
} }

View File

@ -106,7 +106,7 @@ func TestMessenger_Dispatch(t *testing.T) {
messages := []MessageInfo{ messages := []MessageInfo{
{ {
Sender: Sender{111}, Sender: Sender{111},
Recipient: Recipient{222}, Recipient: Recipient{ID: 222},
// 2018-11-24 21:31:51 UTC + 999ms // 2018-11-24 21:31:51 UTC + 999ms
Timestamp: 1543095111999, Timestamp: 1543095111999,
Message: &Message{}, Message: &Message{},
@ -138,7 +138,7 @@ func TestMessenger_Dispatch(t *testing.T) {
messages := []MessageInfo{ messages := []MessageInfo{
{ {
Sender: Sender{111}, Sender: Sender{111},
Recipient: Recipient{222}, Recipient: Recipient{ID: 222},
// 2018-11-24 21:31:51 UTC + 999ms // 2018-11-24 21:31:51 UTC + 999ms
Timestamp: 1543095111999, Timestamp: 1543095111999,
Delivery: &Delivery{}, Delivery: &Delivery{},
@ -170,7 +170,7 @@ func TestMessenger_Dispatch(t *testing.T) {
messages := []MessageInfo{ messages := []MessageInfo{
{ {
Sender: Sender{111}, Sender: Sender{111},
Recipient: Recipient{222}, Recipient: Recipient{ID: 222},
// 2018-11-24 21:31:51 UTC + 999ms // 2018-11-24 21:31:51 UTC + 999ms
Timestamp: 1543095111999, Timestamp: 1543095111999,
Read: &Read{}, Read: &Read{},
@ -205,7 +205,7 @@ func TestMessenger_Dispatch(t *testing.T) {
messages := []MessageInfo{ messages := []MessageInfo{
{ {
Sender: Sender{111}, Sender: Sender{111},
Recipient: Recipient{222}, Recipient: Recipient{ID: 222},
// 2018-11-24 21:31:51 UTC + 999ms // 2018-11-24 21:31:51 UTC + 999ms
Timestamp: 1543095111999, Timestamp: 1543095111999,
PostBack: &PostBack{}, PostBack: &PostBack{},
@ -240,7 +240,7 @@ func TestMessenger_Dispatch(t *testing.T) {
messages := []MessageInfo{ messages := []MessageInfo{
{ {
Sender: Sender{111}, Sender: Sender{111},
Recipient: Recipient{222}, Recipient: Recipient{ID: 222},
// 2018-11-24 21:31:51 UTC + 999ms // 2018-11-24 21:31:51 UTC + 999ms
Timestamp: 1543095111999, Timestamp: 1543095111999,
OptIn: &OptIn{}, OptIn: &OptIn{},
@ -275,7 +275,7 @@ func TestMessenger_Dispatch(t *testing.T) {
messages := []MessageInfo{ messages := []MessageInfo{
{ {
Sender: Sender{111}, Sender: Sender{111},
Recipient: Recipient{222}, Recipient: Recipient{ID: 222},
// 2018-11-24 21:31:51 UTC + 999ms // 2018-11-24 21:31:51 UTC + 999ms
Timestamp: 1543095111999, Timestamp: 1543095111999,
ReferralMessage: &ReferralMessage{}, ReferralMessage: &ReferralMessage{},

View File

@ -87,7 +87,9 @@ type Sender struct {
// Recipient is who the message was sent to. // Recipient is who the message was sent to.
type Recipient struct { 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. // Attachment is a file which used in a message.