Permalink
Browse files

ReplyGif

Converts links to an image on ReplyGif into an embedded image in Campfire. Also
listens for the `replygif` command and embeds the relevant ReplyGif based on
either a keyword or the ReplyGif ID.

See http://replygif.net.
  • Loading branch information...
1 parent ae4577a commit d9f6766581a64476fb5247182a0582ac0e52abe9 @sumeetjain sumeetjain committed Dec 1, 2012
Showing with 35 additions and 0 deletions.
  1. +35 −0 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"

0 comments on commit d9f6766

Please sign in to comment.