Fixed NewBotAPIWithClient
parent
2483f04397
commit
3101266b61
10
bot.go
10
bot.go
|
@ -15,16 +15,12 @@ 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) (*BotAPI, error) {
|
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
|
// Requires a token, provided by @BotFather on Telegram
|
||||||
func NewBotAPIwithClient(token string, client *http.Client) (*BotAPI, error) {
|
func NewBotAPIWithClient(token string, client *http.Client) (*BotAPI, error) {
|
||||||
if client == nil {
|
|
||||||
client = &http.Client{}
|
|
||||||
}
|
|
||||||
|
|
||||||
bot := &BotAPI{
|
bot := &BotAPI{
|
||||||
Token: token,
|
Token: token,
|
||||||
Client: client,
|
Client: client,
|
||||||
|
|
Loading…
Reference in New Issue