Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor

Showing 2 changed files with 21 additions and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  hubot-scripts.json
  2. +20 0 scripts/coffeeme.coffee
2  hubot-scripts.json
... ... @@ -1 +1 @@
1   -["redis-brain.coffee", "tweet.coffee", "shipit.coffee", "github-issues.coffee", "github-pulls.coffee", "github-activity.coffee", "remind.coffee", "tasks.coffee", "fml.coffee", "git-help.coffee", "look-of-disapproval.coffee","mind-blown.coffee", "redis-brain.coffee", "inspire.coffee"]
  1 +["redis-brain.coffee", "tweet.coffee", "shipit.coffee", "github-issues.coffee", "github-pulls.coffee", "github-activity.coffee", "remind.coffee", "tasks.coffee", "fml.coffee", "git-help.coffee", "look-of-disapproval.coffee","mind-blown.coffee", "redis-brain.coffee","coffeeme.coffee", "inspire.coffee"]
20 scripts/coffeeme.coffee
... ... @@ -0,0 +1,20 @@
  1 +# Returns awesome coffee image from Google.
  2 +#
  3 +# coffee me <query> - The Original. Queries Google Images for <query> and
  4 +
  5 +module.exports = (robot) ->
  6 + robot.respond /(coffee)( me)? (.*)/i, (msg) ->
  7 + imageMe coffee is awesome, (url) ->
  8 + msg.send url
  9 +
  10 +
  11 +
  12 +imageMe = (msg, query, cb) ->
  13 + msg.http('http://ajax.googleapis.com/ajax/services/search/images')
  14 + .query(v: "1.0", rsz: '8', q: query)
  15 + .get() (err, res, body) ->
  16 + images = JSON.parse(body)
  17 + images = images.responseData.results
  18 + image = msg.random images
  19 + cb "#{image.unescapedUrl}#.png"
  20 +

No commit comments for this range

Something went wrong with that request. Please try again.