Skip to content
Browse files

Improve success rate of mustachification

imgtype=face tries to return results that contain human faces
making it easier for mustachify to do its job.
  • Loading branch information...
1 parent d1986d9 commit a9b4e1c662e28f64c43da8a1285cada16aa43aa1 @Seldaek committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/scripts/google-images.coffee
View
6 src/scripts/google-images.coffee
@@ -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) ->

0 comments on commit a9b4e1c

Please sign in to comment.
Something went wrong with that request. Please try again.