From 42e17ae755489a393beac0c0d06e1b64551889a5 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 1 Jun 2013 14:40:06 -0400 Subject: [PATCH] Removing secondary URL --- plugins/factoid.go | 13 +------------ plugins/webTemplates.go | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/plugins/factoid.go b/plugins/factoid.go index 6c9b0f2..72191c1 100644 --- a/plugins/factoid.go +++ b/plugins/factoid.go @@ -449,20 +449,11 @@ func (p *FactoidPlugin) BotMessage(message bot.Message) bool { // Register any web URLs desired func (p *FactoidPlugin) RegisterWeb() *string { http.HandleFunc("/factoid/req", p.serveQuery) - http.HandleFunc("/factoid", p.serveIndex) + http.HandleFunc("/factoid", p.serveQuery) tmp := "/factoid" return &tmp } -// Serve up the index template -func (p *FactoidPlugin) serveIndex(w http.ResponseWriter, r *http.Request) { - t, err := template.New("factoidIndex").Parse(factoidIndex) - if err != nil { - log.Println(err) - } - t.Execute(w, nil) -} - func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) { context := make(map[string]interface{}) if e := r.PostFormValue("entry"); e != "" { @@ -471,8 +462,6 @@ func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) { context["Count"] = fmt.Sprintf("%d", len(entries)) context["Entries"] = entries context["Search"] = e - } else { - context["Error"] = "Something's fucked." } t, err := template.New("factoidIndex").Parse(factoidIndex) if err != nil { diff --git a/plugins/webTemplates.go b/plugins/webTemplates.go index df08b6f..84af117 100644 --- a/plugins/webTemplates.go +++ b/plugins/webTemplates.go @@ -11,7 +11,7 @@ var factoidIndex string = `
-
+
Search for a factoid