all repos — telegram-bot-api @ 3101266b614ca587b4081c0d83a4832807e80390

Golang bindings for the Telegram Bot API

Fixed NewBotAPIWithClient
Raul Santos raulsntos@gmail.com
Tue, 28 Jul 2015 18:14:13 +0200
commit

3101266b614ca587b4081c0d83a4832807e80390

parent

2483f043976a025de9c97f53dfcaa4894c090b8b

1 files changed, 3 insertions(+), 7 deletions(-)

jump to
M bot.gobot.go

@@ -15,16 +15,12 @@

// 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,