cowsay: make messages visible :(

This commit is contained in:
Chris Sexton 2019-02-21 10:01:10 -05:00
parent 300de48c39
commit d4c8788a82
1 changed files with 5 additions and 2 deletions

View File

@ -173,11 +173,14 @@ func (p *TalkerPlugin) registerWeb() {
http.HandleFunc("/slash/cowsay", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/slash/cowsay", func(w http.ResponseWriter, r *http.Request) {
r.ParseForm() r.ParseForm()
log.Printf("Cowsay:\n%+v", r.PostForm.Get("text")) 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")) msg, err := p.cowSay(r.PostForm.Get("text"))
if err != nil { 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 return
} }
fmt.Fprintf(w, "%s", msg) p.Bot.Send(bot.Message, channel, msg)
w.WriteHeader(200)
}) })
} }