forked from github/hubot-scripts
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 d9f6766
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |