Stop returning useless http.Handler from ListenForWebhook.

This commit is contained in:
Syfaro 2016-01-03 23:05:36 -06:00
parent 08d7c01637
commit 80e30d7c19
3 changed files with 5 additions and 23 deletions

8
bot.go
View file

@ -452,10 +452,10 @@ func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (<-chan Update, error) {
}
// ListenForWebhook registers a http handler for a webhook.
func (bot *BotAPI) ListenForWebhook(pattern string) (<-chan Update, http.Handler) {
func (bot *BotAPI) ListenForWebhook(pattern string) <-chan Update {
updatesChan := make(chan Update, 100)
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {
bytes, _ := ioutil.ReadAll(r.Body)
var update Update
@ -464,9 +464,7 @@ func (bot *BotAPI) ListenForWebhook(pattern string) (<-chan Update, http.Handler
updatesChan <- update
})
http.HandleFunc(pattern, handler)
return updatesChan, handler
return updatesChan
}
// AnswerInlineQuery sends a response to an inline query.