4
4
"context"
5
5
"database/sql"
6
6
"errors"
7
+ "fmt"
7
8
"goirc/bot"
8
9
"goirc/db/model"
9
10
"goirc/events"
@@ -23,13 +24,16 @@ import (
23
24
"goirc/internal/ai"
24
25
db "goirc/model"
25
26
"goirc/web"
27
+ "regexp"
26
28
"time"
27
29
28
30
"github.com/robfig/cron"
29
31
"github.com/sashabaranov/go-openai"
30
32
)
31
33
32
34
func addHandlers (b * bot.Bot ) {
35
+ nick := regexp .QuoteMeta (b .Conn .GetNick ())
36
+
33
37
b .Handle (`^!catchup` , handlers .Catchup )
34
38
b .Handle (`^,(.+)$` , handlers .CreateNote )
35
39
b .Handle (`^([^\s:]+): (.+)$` , handlers .DeferredDelivery )
@@ -70,8 +74,8 @@ func addHandlers(b *bot.Bot) {
70
74
b .Handle (`^!deauth$` , web .HandleDeauth )
71
75
b .Handle (`night` , bedtime .Handle )
72
76
b .Handle (`^!election` , election .Handle )
73
- b .Handle (`^annie :?(.+)$` , annie .Handle )
74
- b .Handle (`^(.+),? annie .?$` , annie .Handle )
77
+ b .Handle (fmt . Sprintf ( `^%s :?(.+)$`, nick ) , annie .Handle )
78
+ b .Handle (fmt . Sprintf ( `^(.+),? %s .?$` , nick ) , annie .Handle )
75
79
b .Handle (`^!bible (.+)$` , bible .Handle )
76
80
77
81
b .Repeat (10 * time .Second , handlers .DoRemind )
0 commit comments