diff --git a/chat-bots-contrib/test/Spec.hs b/chat-bots-contrib/test/Spec.hs index 00e1e1d..6888dff 100644 --- a/chat-bots-contrib/test/Spec.hs +++ b/chat-bots-contrib/test/Spec.hs @@ -142,3 +142,11 @@ sessionizedBotSpec = <<>>new body of text that happens to begin with the word new + >>>use body of text that begins with the word use + >>>end body of text that begins with the word end + |] diff --git a/chat-bots/src/Data/Chat/Bot/Context.hs b/chat-bots/src/Data/Chat/Bot/Context.hs index 9513ffd..9186526 100644 --- a/chat-bots/src/Data/Chat/Bot/Context.hs +++ b/chat-bots/src/Data/Chat/Bot/Context.hs @@ -134,7 +134,9 @@ sessionizedParser :: (Text -> Maybe i) -> Parser (SessionInput i) sessionizedParser p = do keyword <- New <$ "new" <|> Use <$ "use" <|> End <$ "end" case keyword of - New -> pure StartSession + New -> do + _ <- endOfInput <|> endOfLine + pure StartSession Use -> do _ <- space n <- decimal <* ": "