iamvery / lita-static-meme

Configurable Lita handler for responding to certain phrases with images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lita-static-meme

lita-static-meme is a handler for Lita that allows you to respond to arbitrary regular expressions with given images.

There are existing gems that dynamically generate memes from given snippets of text, but sometimes you just want Lita to respond to a particular phrase with a static image. One approach would be to write a separate handler for each phrase / image pair, but wouldn't you rather just specify a mapping between regular expressions and URLs? (I would!)

Installation

As per usual, add that puppy to your Gemfile:

gem 'lita-static-meme', github: 'killpack/lita-static-meme'

Configuration

Lita.configure do |config|
  ...
  config.handlers.static_meme.mapping = {
    /ship it/i => "https://skitch-img.s3.amazonaws.com/20111026-r2wsngtu4jftwxmsytdke6arwd.png", # specify a single response image...
    /deal with it/i => ["http://i.imgur.com/ykDuU.gif", "http://i.imgur.com/3PWHn.gif"] # ...or a set to randomly choose from
  }
  ...
end

Usage

Given the configuration above:

jordan_killpack: blah blah blah she should just deal with it already

Lita: DEAL WITH IT

About

Configurable Lita handler for responding to certain phrases with images.


Languages

Language:Ruby 100.0%