Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 31 lines (29 sloc) 0.738 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# Description:
# Suggests an oblique strategy
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot strategy - Suggests a strategy
# hubot a strategy for <user> - Suggests a strategy to user
#
# Notes:
# You can be as verbose as you want as long as you address Hubot and mention
# the word strategy and, optionally, one or more users.
#
# Thanks, Brian Eno.
#
# Author:
# hakanensari

module.exports = (robot) ->
  robot.respond /.*strategy/i, (msg) ->
    mentions = msg.message.text.match(/(@\w+)/g)
    robot.http('http://oblique.io')
      .get() (err, res, body) ->
        strategy = JSON.parse body
        strategy = "#{mentions.join(', ')}: #{strategy}" if mentions
        msg.send strategy
Something went wrong with that request. Please try again.