Skip to content

Commit

Permalink
Updated for working with the extra space after the user handle
Browse files Browse the repository at this point in the history
  • Loading branch information
avarghese-sqsp committed May 2, 2020
1 parent 229c44c commit 47f8bcc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/karma-classic.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ module.exports = (robot) ->
###
# Listen for "++" messages and increment
###
robot.hear /@?(\S+[^+\s])\+\+(\s|$)/, (msg) ->
robot.hear /@?(\S+[^+\s])\s?\+\+(\s|$)/, (msg) ->
subject = msg.match[1].toLowerCase()
karma.increment subject
msg.send "#{subject} #{karma.incrementResponse()} (Karma: #{karma.get(subject)})"

###
# Listen for "--" messages and decrement
###
robot.hear /@?(\S+[^-\s])--(\s|$)/, (msg) ->
robot.hear /@?(\S+[^-\s])\s?--(\s|$)/, (msg) ->
subject = msg.match[1].toLowerCase()
# avoid catching HTML comments
unless subject[-2..] == "<!"
Expand Down Expand Up @@ -138,4 +138,3 @@ module.exports = (robot) ->
match = msg.match[1].toLowerCase()
if not (match in ["best", "worst"])
msg.send "\"#{match}\" has #{karma.get(match)} karma."

0 comments on commit 47f8bcc

Please sign in to comment.