From 3101266b614ca587b4081c0d83a4832807e80390 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Tue, 28 Jul 2015 18:14:13 +0200 Subject: [PATCH] Fixed NewBotAPIWithClient --- bot.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bot.go b/bot.go index 74c867b..89a456a 100644 --- a/bot.go +++ b/bot.go @@ -15,16 +15,12 @@ type BotAPI struct { // NewBotAPI creates a new BotAPI instance. // Requires a token, provided by @BotFather on Telegram func NewBotAPI(token string) (*BotAPI, error) { - return NewBotAPIwithClient(token, nil) + return NewBotAPIwithClient(token, &http.Client{}) } -// NewBotAPI creates a new BotAPI instance passing an http.Client. +// NewBotAPIWithClient creates a new BotAPI instance passing an http.Client. // Requires a token, provided by @BotFather on Telegram -func NewBotAPIwithClient(token string, client *http.Client) (*BotAPI, error) { - if client == nil { - client = &http.Client{} - } - +func NewBotAPIWithClient(token string, client *http.Client) (*BotAPI, error) { bot := &BotAPI{ Token: token, Client: client,