From 3da482d48583a697e9cd0dab44d3147c9bc19387 Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Fri, 9 Aug 2019 17:59:16 +0300 Subject: fix raw attachments --- api.go | 4 ++-- models.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api.go b/api.go index 1591398..7078665 100644 --- a/api.go +++ b/api.go @@ -55,7 +55,7 @@ func (a *Api) bytesToProperUpdate(b []byte) UpdateInterface { case TypeMessageCreated: upd := new(MessageCreatedUpdate) _ = json.Unmarshal(b, upd) - for _, att := range upd.Message.Body.rawAttachments { + for _, att := range upd.Message.Body.RawAttachments { upd.Message.Body.Attachments = append(upd.Message.Body.Attachments, a.bytesToProperAttachment(att)) } return upd @@ -66,7 +66,7 @@ func (a *Api) bytesToProperUpdate(b []byte) UpdateInterface { case TypeMessageEdited: upd := new(MessageEditedUpdate) _ = json.Unmarshal(b, upd) - for _, att := range upd.Message.Body.rawAttachments { + for _, att := range upd.Message.Body.RawAttachments { upd.Message.Body.Attachments = append(upd.Message.Body.Attachments, a.bytesToProperAttachment(att)) } return upd diff --git a/models.go b/models.go index 7dc79e1..000d520 100644 --- a/models.go +++ b/models.go @@ -356,7 +356,7 @@ type MessageBody struct { Mid string `json:"mid"` // Unique identifier of message Seq int `json:"seq"` // Sequence identifier of message in chat Text string `json:"text,omitempty"` // Message text - rawAttachments []json.RawMessage `json:"attachments"` // Message attachments. Could be one of `Attachment` type. See description of this schema + RawAttachments []json.RawMessage `json:"attachments"` // Message attachments. Could be one of `Attachment` type. See description of this schema Attachments []interface{} ReplyTo string `json:"reply_to,omitempty"` // In case this message is reply to another, it is the unique identifier of the replied message } -- cgit v1.2.3