Skip to content

Commit

Permalink
ReplyGif
Browse files Browse the repository at this point in the history
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
sumeetjain committed Dec 1, 2012
1 parent ae4577a commit d9f6766
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions 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.