Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 228c6a7

Browse files
committed
Merge pull request #495 from ajacksified/which-do-you-prefer
Which do you prefer?
2 parents ea2fb71 + 260b487 commit 228c6a7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Description:
2+
# Which does hubot like best? Find out.
3+
#
4+
# Dependencies:
5+
# None
6+
#
7+
# Configuration:
8+
# None
9+
#
10+
# Commands:
11+
# hubot which do you prefer: <thing> or <thing> [.. or <thing>]?
12+
#
13+
# Author:
14+
# ajacksified
15+
16+
module.exports = (robot) ->
17+
robot.respond /(which )?do you (like|like best|prefer)[:,\s]? (.*)$/i, (msg) ->
18+
split = msg.match[3].split(" or ")
19+
thing = split[(Math.random() * split.length) >> 0]
20+
21+
if thing[thing.length-1] == '?' then thing = thing[0..thing.length-2]
22+
23+
msg.send("I #{msg.match[2]} #{thing}.")

0 commit comments

Comments
 (0)