update bot struct

pull/271/head
Sergey Ryazanov 6 years ago
parent b33efeebc7
commit 67c024dc85
  1. 8
      bot.go
  2. 1
      configs.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()

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