From b1c450da08ce29f23cfd283fb068843350e9c622 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Thu, 21 Feb 2019 10:01:10 -0500 Subject: [PATCH] cowsay: make messages visible :( --- plugins/talker/talker.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/talker/talker.go b/plugins/talker/talker.go index 92ef3ac..38153d9 100644 --- a/plugins/talker/talker.go +++ b/plugins/talker/talker.go @@ -173,11 +173,14 @@ func (p *TalkerPlugin) registerWeb() { http.HandleFunc("/slash/cowsay", func(w http.ResponseWriter, r *http.Request) { r.ParseForm() log.Printf("Cowsay:\n%+v", r.PostForm.Get("text")) + channel := r.PostForm.Get("channel_id") + log.Printf("channel: %s", channel) msg, err := p.cowSay(r.PostForm.Get("text")) if err != nil { - fmt.Fprintf(w, "Error running cowsay: %s", err) + p.Bot.Send(bot.Message, channel, fmt.Sprintf("Error running cowsay: %s", err)) return } - fmt.Fprintf(w, "%s", msg) + p.Bot.Send(bot.Message, channel, msg) + w.WriteHeader(200) }) }