Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added yell script to mention everyone in the chat room

  • Loading branch information...
commit 60f30f6885cf85663292a1bef660b32ea01269ae 1 parent 6ad6a9a
@mattsjohnston mattsjohnston authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 src/scripts/yell.coffee
View
29 src/scripts/yell.coffee
@@ -0,0 +1,29 @@
+# Description
+# Allows you to "yell" your message to everyone in the room
+#
+# Dependencies:
+# None
+#
+# Configuration:
+# None
+#
+# Commands:
+# hubot yell <message> - Sends your message and mentions everyone curently in the chat room.
+#
+# Notes:
+# Nobody likes when you yell all the time :(
+#
+# Author:
+# MattSJohnston
+
+module.exports = (robot) ->
+
+ _ = require 'underscore'
+
+ robot.respond /yell (.*)/i, (msg) ->
+ users = _.reject((_.values _.pluck robot.brain.data.users, 'name'), (name) -> name == msg.message.user.name)
+ msg.send if users.length then users.join(', ') + ": #{msg.match[1]}" else "If a tree falls in a forest and no one is around to hear it, does it make a sound?"
+
+
+toTitleCase = (str) ->
+ str.replace /\w\S*/g, (txt) -> txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
Please sign in to comment.
Something went wrong with that request. Please try again.