ajacksified / hubot-plusplus

Welcome to Hubot, where the points don't matter
MIT License
59 stars 101 forks source link

plusplus to special characters as well? #75

Open namratachaudhary opened 7 years ago

namratachaudhary commented 7 years ago

regex for thing being upvoted/downvoted is broken. -- works for special chars & empty strings as well.

image

image

Running ver 1.4.0

namratachaudhary commented 7 years ago

([\s\w'@.\-:\u3040-\u30FF\uFF01-\uFF60\u4E00-\u9FA0]*)

The .\- part in above regex means, a dot and hyphen are valid.

This regex could probably be accounting for names with hyphens in them. and hence the discrepancy.

The empty string issue could be, since the last character that got upvoted or downvoted is being cached.

    # check whether a name was specified. use MRU if not
    unless name? && name != ''
      [name, lastReason] = scoreKeeper.last(room)
      reason = lastReason if !reason? && lastReason?
therealklanni commented 7 years ago

If by "empty string" you mean the ability to say ++ to up/downvote the last thing up/downvoted, that's actually a feature, not a bug.

The RegExp for special characters could use some improvement, however. I'm open to PRs :)