testing webhooks
This commit is contained in:
parent
caa291e0ea
commit
87857b4509
|
@ -7,6 +7,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.dnix.de/an/xlog"
|
||||
)
|
||||
|
@ -28,17 +29,17 @@ func webhookRun() {
|
|||
}
|
||||
|
||||
func webhookHandleMessage(m *Message) {
|
||||
// tok := strings.Split(m.Text, " ")
|
||||
// if len(tok) < 1 {
|
||||
// return
|
||||
// }
|
||||
// switch tok[0] {
|
||||
// case "!webhook-add":
|
||||
// if len(tok) > 1 {
|
||||
// http.HandleFunc("/webhook/"+tok[1], webhookHandleHTTP)
|
||||
// }
|
||||
// default:
|
||||
// }
|
||||
tok := strings.Split(m.Text, " ")
|
||||
if len(tok) < 1 {
|
||||
return
|
||||
}
|
||||
switch tok[0] {
|
||||
case "!webhook-add":
|
||||
if len(tok) > 1 {
|
||||
http.HandleFunc("/webhook/"+tok[1], webhookHandleHTTP)
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
func webhookHandleHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in New Issue