diff --git a/bot.go b/bot.go index e201944..c4ed833 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 bef68b8..5c50292 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 @@ -410,7 +411,7 @@ type InlineKeyboardButton struct { SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // optional SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // optional CallbackGame *CallbackGame `json:"callback_game,omitempty"` // optional - Pay bool `json:"pay,omitempty"` // optional + Pay bool `json:"pay,omitempty"` // optional } // CallbackQuery is data sent when a keyboard button with callback data