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