From b182c18d4902a7e8d02bc3806ebdf8b59a624ef5 Mon Sep 17 00:00:00 2001 From: sneak Date: Sun, 13 Sep 2020 00:49:19 -0700 Subject: [PATCH] should now allow "bot" address too --- bot/bot.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bot/bot.go b/bot/bot.go index 56472ef..aac815d 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -221,6 +221,8 @@ func (b *Bot) HandleWebSocketResponse(event *model.WebSocketEvent) { return } + // FIXME check for parts and joins and whatnot and ignore those + // check to see if we have been addressed if matched, _ := regexp.MatchString(`^\s*`+b.BotName+`\s*`, post.Message); matched { println("i have been addressed in channel " + post.ChannelId) @@ -229,6 +231,13 @@ func (b *Bot) HandleWebSocketResponse(event *model.WebSocketEvent) { return } + if matched, _ := regexp.MatchString(`^\s*bot([\,]?)\s*`, post.Message); matched { + println("i have been addressed in channel " + post.ChannelId) + //b.SendMsgToDebuggingChannel("i have been addressed in channel "+post.ChannelId, "") + b.HandleMsgFromChannel(event) + return + } + if event.Broadcast.ChannelId == b.debuggingChannel.Id { b.HandleMsgFromDebuggingChannel(event) return