From 87857b4509d5ffd3f675577159b39f3acb5fd967 Mon Sep 17 00:00:00 2001 From: an Date: Sun, 22 Apr 2018 14:21:58 +0200 Subject: [PATCH] testing webhooks --- modules/webhook.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/webhook.go b/modules/webhook.go index 9a4a481..74ae12a 100644 --- a/modules/webhook.go +++ b/modules/webhook.go @@ -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) {