From bd47ce3567273051e0f24ba58a99adcb95bce82d Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Sat, 5 Mar 2022 19:14:17 +0100 Subject: [PATCH] feat: Add Response#Raw with raw json string --- client.go | 3 ++- types.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index dede561..aa033ce 100644 --- a/client.go +++ b/client.go @@ -37,7 +37,7 @@ func (c *Client) Post(url string, data url.Values) ([]byte, error) { func (c *Client) GetUpdates() (Response, error) { var res Response - + values := url.Values{} values.Set("offset", strconv.FormatInt(c.Offset, 10)) values.Set("timeout", strconv.FormatInt(c.PollTimeout, 10)) @@ -46,6 +46,7 @@ func (c *Client) GetUpdates() (Response, error) { return res, err } + res.Raw = string(body) err = json.Unmarshal(body, &res) if len(res.Result) > 0 { diff --git a/types.go b/types.go index a4ec679..e4abe64 100644 --- a/types.go +++ b/types.go @@ -3,6 +3,7 @@ package telegram type Response struct { Ok bool `json:"ok"` Result []Update `json:"result"` + Raw string `json:""` } type Author struct { @@ -71,6 +72,6 @@ type Message struct { } type SendMessageResponse struct { - Ok bool `json:"ok"` + Ok bool `json:"ok"` Result Message `json:"result"` }