Skip to content

Commit

Permalink
Merge pull request #244 from donthorp/kandan-174
Browse files Browse the repository at this point in the history
Fixes #174. Prints a pithy message if you misuse /me
  • Loading branch information
fusion94 committed Mar 28, 2013
2 parents 6209287 + 19ff5c9 commit 5f15fbd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/assets/javascripts/backbone/plugins/me_announce.js.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
class Kandan.Plugins.MeAnnounce

@options:
regex: /^/me /
regex: /^/me( |$)/

@init: ()->
Kandan.Modifiers.register @options.regex, (message, activity) =>
actor = activity.user.username || activity.user.email
message = message.replace @options.regex, "#{actor} "
if message.length == 8 || message.length == 9
message = "#{actor} whistles in the wind."
else
message = message.replace @options.regex, "#{actor} "
return message

0 comments on commit 5f15fbd

Please sign in to comment.