Sha256: 939afb6ae2b9e190b8cc48b8477a94cc077fc2a37f62e19290cc4a23c7248638

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

require "artii"

module Lita
  module Handlers
    class AsciiArt < Handler
      route(/^ascii\s+(.*)/i, :ascii_from_text, command: true, help: {
        t("help.ascii_key") => t("help.ascii_value")})

        @@art = Artii::Base.new :font => 'standard'

      def ascii_from_text(response)
        s = ''
        response.matches.first.each do |c|
          s += @@art.asciify(c)
        end
        case robot.config.robot.adapter
        when :slack
          response.reply "```" + s + "```"
        else
          response.reply s
        end
      end
    end

    Lita.register_handler(AsciiArt)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-ascii-art-0.0.3 lib/lita/handlers/ascii_art.rb