This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add grub script

  • Loading branch information...
1 parent ae4577a commit 481b2caf5ba454931380df4cded9ec630e1ce479 @carmstrong carmstrong committed Nov 12, 2012
Showing with 44 additions and 0 deletions.
  1. +44 −0 src/scripts/grub.coffee
View
@@ -0,0 +1,44 @@
+# Description:
+# Decides where your team should get their grub on
+#
+# Dependencies:
+# None
+#
+# Configuration:
+# None
+#
+# Commands:
+# grub add - Add a grubbery to the list
+# grub rm - Remove a grubbery from the list
+# grub ls - List all of the grubberies that have been added
+# grub time - Chooses a grubbery at random
+#
+# Notes:
+# None
+#
+# Author:
+# carmstrong
+
+module.exports = (robot) ->
+ robot.brain.on 'loaded', =>
+ robot.brain.data.grub ||= []
+
+ robot.hear /grub add (.*)/i, (msg) ->
+ grubhub = msg.match[1]
+ if grubhub.length
+ robot.brain.data.grub.push(grubhub)
+ else
+ msg.send "Provide a grubbery..."
+
+ robot.hear /grub rm (.*)/i, (msg) ->
+ grubhub = msg.match[1]
+ if grubhub.length
+ robot.brain.data.grub = robot.brain.data.grub.filter (x) -> x != grubhub
+ else
+ msg.send "Provide a grubbery..."
+
+ robot.hear /grub ls/i, (msg) ->
+ msg.send "Grubberies: #{ robot.brain.data.grub.join(", ") }"
+
+ robot.hear /grub time/i, (msg) ->
+ msg.send "We're grubbing at #{ msg.random robot.brain.data.grub } today"

0 comments on commit 481b2ca

Please sign in to comment.