pull/136/merge
recoilme 7 years ago committed by GitHub
commit 902e1ae418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      bot.go
  2. 1
      types.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 {

@ -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