From 13bc9e3cd0feefae1f45f7e0d2d6a71fc941ea47 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Tue, 19 May 2015 23:25:28 -0400 Subject: [PATCH] add set --- scripts/q.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/q.coffee b/scripts/q.coffee index bdddd94..ca8b214 100644 --- a/scripts/q.coffee +++ b/scripts/q.coffee @@ -69,6 +69,18 @@ module.exports = (robot) -> robot.messageRoom ROOM, "#{current} is now Queue boss" res.say "#{current} is now Queue boss" + robot.respond /q set (.*)/i, (res) -> + rotation = robot.brain.get('rotation') + current = robot.brain.get('currentRotation') + request = res.match[1].trim() + index = rotation.indexOf(request); + if index > -1 + robot.brain.set('currentRotation', request) + robot.messageRoom ROOM, "#{request} is now Queue boss" + res.say "#{request} is now Queue boss" + else + robot.say "Could not find #{request} in rotation" + # robot.hear /badger/i, (res) -> # res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS"