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

Commit 516db21

Browse files
author
Tom Bell
committed
Merge pull request #937 from papercavalier/oblique-strategy
Allows Hubot to suggest oblique strategies to other users
2 parents e37faf2 + 9de71a1 commit 516db21

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/scripts/oblique.coffee

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Description:
2-
# Display an oblique strategy
2+
# Suggests an oblique strategy
33
#
44
# Dependencies:
55
# None
@@ -8,13 +8,23 @@
88
# None
99
#
1010
# Commands:
11-
# hubot strategy - Returns an oblique strategy
11+
# hubot strategy - Suggests a strategy
12+
# hubot a strategy for <user> - Suggests a strategy to user
13+
#
14+
# Notes:
15+
# You can be as verbose as you want as long as you address Hubot and mention
16+
# the word strategy and, optionally, one or more users.
17+
#
18+
# Thanks, Brian Eno.
1219
#
1320
# Author:
1421
# hakanensari
1522

1623
module.exports = (robot) ->
17-
robot.respond /\W*(?:an? )?(?:oblique )?strategy\??$/i, (msg) ->
18-
msg.http('http://oblique.io')
24+
robot.respond /.*strategy/i, (msg) ->
25+
mentions = msg.message.text.match(/(@\w+)/g)
26+
robot.http('http://oblique.io')
1927
.get() (err, res, body) ->
20-
msg.send JSON.parse body
28+
strategy = JSON.parse body
29+
strategy = "#{mentions.join(', ')}: #{strategy}" if mentions
30+
msg.send strategy

0 commit comments

Comments
 (0)