Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #635 from sumeetjain/master

ReplyGif - Animated Gifs
  • Loading branch information...
commit 325386b35e925e4b559bdf1b539ec225cb29edb5 2 parents ae4577a + d9f6766
@atmos atmos authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 src/scripts/replygif.coffee
View
35 src/scripts/replygif.coffee
@@ -0,0 +1,35 @@
+# Description:
+# Makes ReplyGif easier to use. See http://replygif.net.
+#
+# Dependencies:
+# None
+#
+# Configuration:
+# None
+#
+# Commands:
+# http://replygif.net/<id> - Embeds image from ReplyGif with that id.
+# hubot replygif <keyword> - Embeds random ReplyGif with the keyword.
+# hubot replygif me <keyword> - Same as `hubot replygif <keyword>`.
+#
+# Notes:
+# Thanks to What Cheer (@whatcheer) for providing the keyword lookup app.
+#
+# Author:
+# sumeetjain
+
+module.exports = (robot) ->
+ # Listen for someone to link to a ReplyGif and reply with the image.
+ robot.hear /.*replygif\.net\/(i\/)?(\d+).*/i, (msg) ->
+ id = msg.match[2]
+ msg.send "http://replygif.net/i/#{id}#.gif"
+
+ # Listen for a command to look up a ReplyGif by ID.
+ robot.respond /replygif( me)? (\d+)/i, (msg) ->
+ id = msg.match[2]
+ msg.send "http://replygif.net/i/#{id}#.gif"
+
+ # Listen for a command to look up a ReplyGif by tag.
+ robot.respond /replygif( me)? (\D+)/i, (msg) ->
+ tag = msg.match[2]
+ msg.send "http://apps.whatcheerinc.com/replygif/#{tag}.gif"
Please sign in to comment.
Something went wrong with that request. Please try again.