Skip to content

Commit

Permalink
Improve success rate of mustachification
Browse files Browse the repository at this point in the history
imgtype=face tries to return results that contain human faces
making it easier for mustachify to do its job.
  • Loading branch information
Seldaek committed Aug 18, 2012
1 parent d1986d9 commit a9b4e1c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scripts/google-images.coffee
Expand Up @@ -24,13 +24,15 @@ module.exports = (robot) ->
if imagery.match /^https?:\/\//i
msg.send "#{mustachify}#{imagery}"
else
imageMe msg, imagery, (url) ->
imageMe msg, imagery, false, true, (url) ->
msg.send "#{mustachify}#{url}"

imageMe = (msg, query, animated, cb) ->
imageMe = (msg, query, animated, faces, cb) ->
cb = animated if typeof animated == 'function'
cb = faces if typeof faces == 'function'
q = v: '1.0', rsz: '8', q: query, safe: 'active'
q.as_filetype = 'gif' if typeof animated is 'boolean' and animated is true
q.imgtype = 'face' if typeof faces is 'boolean' and faces is true
msg.http('http://ajax.googleapis.com/ajax/services/search/images')
.query(q)
.get() (err, res, body) ->
Expand Down

0 comments on commit a9b4e1c

Please sign in to comment.