Browse files

Based HUBOT_9GAG_NO_GIFS on variable definition and existential opera…

…tor.
  • Loading branch information...
1 parent bbafcc7 commit 77f3e0fea8a390d1d7397a293ed41fcfaed772ac @dedeibel committed Feb 4, 2014
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/scripts/9gag.coffee
View
5 src/scripts/9gag.coffee
@@ -6,7 +6,7 @@
# "soupselect": "0.2.0"
#
# Configuration:
-# HUBOT_9GAG_NO_GIFS (optional; default is "false")
+# HUBOT_9GAG_NO_GIFS (optional, skips GIFs if defined; default is undefined)
#
# Commands:
# hubot 9gag me - Returns a random meme image
@@ -40,9 +40,8 @@ send_meme = (message, location, response_handler)->
location = response.headers['location']
return send_meme( message, location, response_handler )
- no_gifs = process.env.HUBOT_9GAG_NO_GIFS
selectors = ["a img.badge-item-img"]
- if no_gifs != '0' && no_gifs != 't' && no_gifs != 'true'
+ if ! process.env.HUBOT_9GAG_NO_GIFS?
selectors.unshift("div.badge-animated-container-animated img")
img_src = get_meme_image( body, selectors )

0 comments on commit 77f3e0f

Please sign in to comment.