queue management
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
"author": "Bob Bergman <rbergman@atlassian.com>",
|
||||
"description": "A simple helpful robot for your Company",
|
||||
"dependencies": {
|
||||
"cron": "^1.0.9",
|
||||
"hubot": "^2.12.0",
|
||||
"hubot-business-cat": "^1.1.19",
|
||||
"hubot-diagnostics": "0.0.1",
|
||||
@@ -20,7 +21,8 @@
|
||||
"hubot-scripts": "^2.5.16",
|
||||
"hubot-shipit": "^0.2.0",
|
||||
"hubot-victory": "^1.3.0",
|
||||
"hubot-youtube": "^0.1.2"
|
||||
"hubot-youtube": "^0.1.2",
|
||||
"time": "^0.11.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x"
|
||||
|
||||
39
scripts/q.coffee
Normal file
39
scripts/q.coffee
Normal file
@@ -0,0 +1,39 @@
|
||||
next = () ->
|
||||
rotation = robot.brain.get('rotation')
|
||||
current = robot.brain.get('current')
|
||||
if current == null || typeof current == "undefined"
|
||||
current = roation[0]
|
||||
else
|
||||
location = rotation.indexOf current
|
||||
if location < 0 || location == (rotation.length - 1)
|
||||
current = rotation[0]
|
||||
else
|
||||
current = rotation[location + 1]
|
||||
robot.brain.set('current', current)
|
||||
robot.messageRoom ROOM, "#{current} is now Queue boss"
|
||||
|
||||
update = new cronJob trigger,
|
||||
->
|
||||
next()
|
||||
null
|
||||
true
|
||||
TIMEZONE
|
||||
|
||||
robot.respond /q add (.*)/i, (res) ->
|
||||
rotation = robot.brain.get('rotation')
|
||||
if rotation == null || typeof rotation == "undefined"?
|
||||
rotation = []
|
||||
rotation.push res.match[0]
|
||||
robot.brain.set "rotation", rotation
|
||||
|
||||
robot.respond /q remove (.*)/i, res() ->
|
||||
rotation = robot.brain.get('rotation')
|
||||
current = robot.brain.get('current')
|
||||
if(current == res.match[0])
|
||||
res.send "User is currently on rotation"
|
||||
else
|
||||
rotation = rotation.filter (word) -> current
|
||||
robot.brain.set('rotation', rotation)
|
||||
|
||||
robot.respond /q next/i, (res) ->
|
||||
next()
|
||||
Reference in New Issue
Block a user