Improve success rate of mustachification #335

Merged
merged 1 commit into from Sep 8, 2012
@@ -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) ->