Skip to content

Commit

Permalink
karma: Add alternative way to declare love
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Mar 26, 2019
1 parent 0c70794 commit 7144f8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugins/Karma.hs
Expand Up @@ -22,7 +22,7 @@ import Text.Regex.TDFA ((=~))


karmaRegex :: String
karmaRegex = "([^[:space:]]+)\\+\\+"
karmaRegex = "([^[:space:]]+)\\+\\+|<3 ([^[:space:]]+)"

-- TODO: Use a single constructor with givenBy being a Maybe (or some iso of it)
-- Needs to migrate the old data
Expand Down Expand Up @@ -80,7 +80,7 @@ karmaPlugin :: Plugin
karmaPlugin = Plugin
{ pluginName = "karma"
, pluginCatcher = \input@Input { inputMessage } ->
case fmap (!!1) (inputMessage =~ karmaRegex :: [[String]]) of
case filter (not . null) . concatMap tail $ (inputMessage =~ karmaRegex :: [[String]]) of
[] -> PassedOn
matches -> Catched True (input, matches)
, pluginHandler = \(Input { inputChannel, inputUser, inputMessage }, unfilteredMatches) -> do
Expand Down

0 comments on commit 7144f8f

Please sign in to comment.