commit
3ce6dbabe0
|
@ -76,7 +76,7 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.ListenForWebhook()
|
bot.ListenForWebhook("/"+bot.Token)
|
||||||
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
|
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
|
||||||
|
|
||||||
for update := range bot.Updates {
|
for update := range bot.Updates {
|
||||||
|
|
|
@ -7,12 +7,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListenForWebhook registers a http handler for a webhook.
|
// ListenForWebhook registers a http handler for a webhook.
|
||||||
// Useful for Google App Engine or other places where you cannot
|
func (bot *BotAPI) ListenForWebhook(pattern string) {
|
||||||
// use a normal update chan.
|
|
||||||
func (bot *BotAPI) ListenForWebhook() {
|
|
||||||
bot.Updates = make(chan Update, 100)
|
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)
|
bytes, _ := ioutil.ReadAll(r.Body)
|
||||||
|
|
||||||
var update Update
|
var update Update
|
||||||
|
|
Loading…
Reference in New Issue