Few bug fixes

pull/6/head
Raul Santos 10 years ago
parent 612584dbd3
commit 8249dd6a93
  1. 4
      bot.go
  2. 2
      methods.go

@ -14,14 +14,14 @@ type BotAPI struct {
// NewBotAPI creates a new BotAPI instance. // NewBotAPI creates a new BotAPI instance.
// Requires a token, provided by @BotFather on Telegram // Requires a token, provided by @BotFather on Telegram
func NewBotAPI(token string, client http.Client) (*BotAPI, error) { func NewBotAPI(token string, client *http.Client) (*BotAPI, error) {
if client == nil { if client == nil {
client = &http.Client{} client = &http.Client{}
} }
bot := &BotAPI{ bot := &BotAPI{
Token: token, Token: token,
Client: client, Client: *client,
} }
self, err := bot.GetMe() self, err := bot.GetMe()

@ -190,7 +190,7 @@ func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldna
w.Close() w.Close()
req, err := bot.Client.NewRequest("POST", "https://api.telegram.org/bot"+bot.Token+"/"+endpoint, &b) req, err := http.NewRequest("POST", "https://api.telegram.org/bot"+bot.Token+"/"+endpoint, &b)
if err != nil { if err != nil {
return APIResponse{}, err return APIResponse{}, err
} }