diff --git a/bot.go b/bot.go index 1a3b7fd..3c1cb31 100644 --- a/bot.go +++ b/bot.go @@ -63,11 +63,17 @@ func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (APIResponse, method := fmt.Sprintf(APIEndpoint, bot.Token, endpoint) resp, err := bot.Client.PostForm(method, params) + if err != nil { return APIResponse{}, err } defer resp.Body.Close() + // Check http response status + if resp.StatusCode != 200 { + return APIResponse{}, errors.New(resp.Status) + } + var apiResp APIResponse bytes, err := bot.decodeAPIResponse(resp.Body, &apiResp) if err != nil { diff --git a/types.go b/types.go index 38bc0f6..40819ae 100644 --- a/types.go +++ b/types.go @@ -142,6 +142,7 @@ type Message struct { EditDate int `json:"edit_date"` // optional Text string `json:"text"` // optional Entities *[]MessageEntity `json:"entities"` // optional + CaptionEntities *[]MessageEntity `json:"caption_entities"` // optional Audio *Audio `json:"audio"` // optional Document *Document `json:"document"` // optional Game *Game `json:"game"` // optional