summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/main.go b/main.go
index 7139d01..9729e87 100644
--- a/main.go
+++ b/main.go
@@ -6,7 +6,6 @@ import (
"fmt"
"log"
"strings"
- "time"
irc "github.com/fluffle/goirc/client"
lru "github.com/hashicorp/golang-lru"
@@ -46,7 +45,6 @@ func (n *Notify) Write(p []byte) (int, error) {
func privmsg(room string) irc.HandlerFunc {
var (
last, _ = lru.New(100)
- lastRe, _ = lru.New(100)
titles, _ = lru.New(100)
)
return func(conn *irc.Conn, line *irc.Line) {
@@ -69,15 +67,13 @@ func privmsg(room string) irc.HandlerFunc {
case strings.HasPrefix(t, "s"):
global := strings.HasSuffix(t, "g")
if tofix, ok := last.Get(line.Nick); ok {
- lre, _ := lastRe.Get(line.Nick)
- d := time.Since(lre.(time.Time))
fixed, err := re(tofix.(string), t[1:], global)
- if err == nil && fixed != tofix && d > time.Second*30 {
- lastRe.Add(line.Nick, time.Now())
+ if err == nil && fixed != tofix {
log.Println("regexp", t)
fmt.Fprintf(NewNotify(conn, line.Target()), "%v meant to say: %s", line.Nick, fixed)
return
}
+
}
fallthrough
default: