Skip to content

Instantly share code, notes, and snippets.

@dstrelau
Created December 9, 2011 15:47
Show Gist options
  • Save dstrelau/1452049 to your computer and use it in GitHub Desktop.
Save dstrelau/1452049 to your computer and use it in GitHub Desktop.
# <tech> is roflscale
responses = [
"Have you thought about trying %?"
"The only way to scale is %."
"Why not just use %?"
"What about using %?"
"I heard % can handle that just fine."
]
Array::remove ?= (e) -> @[t..t] = [] if (t = @indexOf(e)) > -1
module.exports = (robot) ->
robot.brain.data['roflscale'] = robot.brain.data['roflscale'] || []
robot.respond /(.+) is roflscale/i, (msg) ->
if robot.brain.data['roflscale'].indexOf msg.match[1] > -1 ||
robot.brain.data['roflscale'].push msg.match[1]
msg.send "Copy that."
robot.respond /(.+) is not roflscale/i, (msg) ->
if robot.brain.data['roflscale'].remove(msg.match[1])
msg.send "Never thought it was."
robot.hear /scal(e|ability|ing)/i, (msg) ->
return if msg.message.match(/is (not )?roflscale/)
tech = msg.random robot.brain.data['roflscale']
msg.send msg.random(responses).replace '%', tech if tech
robot.hear /speed/i, (msg) ->
tech = msg.random robot.brain.data['roflscale']
msg.send "If you want speed, just use #{tech}." if tech
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment