// Call Telegram API method.
Call Telegram API method.
// Call Telegram API method .
func (e *Bot) CallMethod(method string, params interface{}) ([]byte, error) {
	url := "https://api.telegram.org/bot" + e.token + "/" + method
	body, err := json.Marshal(params)
	if err != nil {
		return nil, err
	}
	res, err := http.Post(url, "application/json", bytes.NewBuffer(body))
	if err != nil {
		return nil, err
	}
	result, err := ioutil.ReadAll(res.Body)
	res.Body.Close()
	if err != nil {
		return nil, err
	}
	return result, nil
}
func ( e * Bot ) CallMethod ( method string , params interface { } ) ( [ ] byte , error ) { url := " " + e . token + " " + method body , err := json . Marshal ( params ) if err != nil { return nil , err } res , err := http . Post ( url , " " , bytes . NewBuffer ( body ) ) if err != nil { return nil , err } result , err := ioutil . ReadAll ( res . Body ) res . Body . Close ( ) if err != nil { return nil , err } return result , nil }
Call Telegram API method.
Call Telegram API method .