Skip to content

Commit

Permalink
Which do you prefer?
Browse files Browse the repository at this point in the history
  • Loading branch information
ajacksified committed Jul 10, 2012
1 parent ea2fb71 commit 9b1c790
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/scripts/which-do-you-prefer.coffee
@@ -0,0 +1,23 @@
# Description:
# Which does hubot like best? Find out.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot which do you prefer: <thing> or <thing> [.. or <thing>]?
#
# Author:
# ajacksified

module.exports = (robot) ->
robot.respond /(which )?do you (like|like best|prefer)[:,\s]? (.*)$/i, (msg) ->
split = msg.match[3].split(" or ")
thing = split[(Math.random() * split.length) >> 0]

if thing[thing.length-1] == '?' then thing = thing[0..thing.length-2]

msg.send("I #{msg.match[1]} #{thing}.")

0 comments on commit 9b1c790

Please sign in to comment.