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" )