api.go
func New(apiKey string) (*TelegramBotAPI, error) {
	toReturn := TelegramBotAPI{
		Updates:  make(chan BotUpdate),
		baseURIs: createEndpoints(fmt.Sprintf(apiBaseURI, apiKey)),
		closed:   make(chan struct{}),
		c:        newClient(fmt.Sprintf(apiBaseURI, apiKey)),
		updateC:  newClient(fmt.Sprintf(apiBaseURI, apiKey)),
	}
	user, err := toReturn.GetMe()
	if err != nil {
		return nil, err
	}
	toReturn.ID = user.User.ID
	toReturn.Name = user.User.FirstName
	toReturn.Username = *user.User.Username

	err = toReturn.removeWebhook()
	if err != nil {
		return nil, err
	}

	toReturn.wg.Add(1)
	go toReturn.updateLoop()

	return &toReturn, nil
}
func New(apiKey string) (*TelegramBotAPI, error) {
	toReturn := TelegramBotAPI{
		Updates:  make(chan BotUpdate),
		baseURIs: createEndpoints(fmt.Sprintf(apiBaseURI, apiKey)),
		closed:   make(chan struct{}),
		c:        newClient(fmt.Sprintf(apiBaseURI, apiKey)),
		updateC:  newClient(fmt.Sprintf(apiBaseURI, apiKey)),
	}
	user, err := toReturn.GetMe()
	if err != nil {
		return nil, err
	}
	toReturn.ID = user.User.ID
	toReturn.Name = user.User.FirstName
	toReturn.Username = *user.User.Username

	err = toReturn.removeWebhook()
	if err != nil {
		return nil, err
	}

	toReturn.wg.Add(1)
	go toReturn.updateLoop()

	return &toReturn, nil
}
// New creates a new API Client for a Telegram bot using the apiKey
// provided.
// It will call the GetMe method to retrieve the bots id, name and
// username.
//
// This bot uses long polling to retrieve its updates. If a webhook was set
// for the given apiKey, this will remove it.