From 67c024dc85c4987ea1806c98b8160cab15b1c808 Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Tue, 17 Sep 2019 18:24:10 +0300 Subject: [PATCH] update bot struct --- bot.go | 8 ++++---- configs.go | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bot.go b/bot.go index a996790..423a212 100644 --- a/bot.go +++ b/bot.go @@ -35,22 +35,22 @@ type BotAPI struct { // NewBotAPI creates a new BotAPI instance. // // It requires a token, provided by @BotFather on Telegram. -func NewBotAPI(token string) (*BotAPI, error) { - return NewBotAPIWithClient(token, &http.Client{}) +func NewBotAPI(token string, api string) (*BotAPI, error) { + return NewBotAPIWithClient(token, api, &http.Client{}) } // NewBotAPIWithClient creates a new BotAPI instance // and allows you to pass a http.Client. // // It requires a token, provided by @BotFather on Telegram. -func NewBotAPIWithClient(token string, client *http.Client) (*BotAPI, error) { +func NewBotAPIWithClient(token string, api string, client *http.Client) (*BotAPI, error) { bot := &BotAPI{ Token: token, Client: client, Buffer: 100, shutdownChannel: make(chan interface{}), - apiEndpoint: APIEndpoint, + apiEndpoint: api, } self, err := bot.GetMe() diff --git a/configs.go b/configs.go index 181d4e4..d5b2706 100644 --- a/configs.go +++ b/configs.go @@ -11,7 +11,6 @@ import ( const ( // APIEndpoint is the endpoint for all API methods, // with formatting for Sprintf. - APIEndpoint = "https://api.telegram.org/bot%s/%s" // FileEndpoint is the endpoint for downloading a file from Telegram. FileEndpoint = "https://api.telegram.org/file/bot%s/%s" )