Sha256: 41372c160c465ffd4fa74f3cb22dae7a1d87c69bb64b8c9870ab738d068cb023
Contents?: true
Size: 1.1 KB
Versions: 11
Compression:
Stored size: 1.1 KB
Contents
require 'cgi' # A simple plugin that wraps memecaptain. # This plugin is activated when robut is sent a message starting # with the name of a meme. The list of generators can be discovered # by running # # @robut meme list # # from the command line. Example: # # @robut meme all_the_things write; all the plugins # # Send message to the specified meme generator. If the meme requires # more than one line of text, lines should be separated with a semicolon. class Robut::Plugin::Meme include Robut::Plugin desc "meme <meme> <line1>;<line2> - responds with a link to a generated <meme> image using <line1> and <line2>. " + "See http://memecaptain.com/ for a list of memes. You can also pass a link to your own image as the meme." match /^meme (\S+) (.*)$/, :sent_to_me => true do |meme, text| if meme.include?("://") url = meme else url = "http://memecaptain.com/#{meme}.jpg" end line1, line2 = text.split(';').map { |line| CGI.escape(line.strip)} meme_url = "http://memecaptain.com/i?u=#{url}&tt=#{line1}" meme_url += "&tb=#{line2}" if line2 reply(meme_url) end end
Version data entries
11 entries across 11 versions & 2 rubygems