all repos — telegram-bot-api @ 3ce6dbabe0265880bdde5cacbb961673bcf55174

Golang bindings for the Telegram Bot API

Merge pull request #23 from gobwas/patch-1

Update webhook.go
Syfaro syfaro@foxpaw.in
Mon, 14 Sep 2015 07:45:18 -0500
commit

3ce6dbabe0265880bdde5cacbb961673bcf55174

parent

7c48fa5dbbe7d71b44fb3d6ddf0687c90bc672de

2 files changed, 3 insertions(+), 5 deletions(-)

jump to
M README.mdREADME.md

@@ -76,7 +76,7 @@ if err != nil {

log.Fatal(err) } - bot.ListenForWebhook() + bot.ListenForWebhook("/"+bot.Token) go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil) for update := range bot.Updates {
M webhook.gowebhook.go

@@ -7,12 +7,10 @@ "net/http"

) // ListenForWebhook registers a http handler for a webhook. -// Useful for Google App Engine or other places where you cannot -// use a normal update chan. -func (bot *BotAPI) ListenForWebhook() { +func (bot *BotAPI) ListenForWebhook(pattern string) { bot.Updates = make(chan Update, 100) - http.HandleFunc("/"+bot.Token, 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