Sha256: de784d18839eccb75e717f3ba3c4bdafa04c8ee1e05252eac9460ff9bcaa530b

Contents?: true

Size: 399 Bytes

Versions: 1

Compression:

Stored size: 399 Bytes

Contents

module Ellen
  module Handlers
    class GoogleImage < Base
      on /image( me)? (?<keyword>.+)/, name: "image", description: "Search image from Google"

      def image(message)
        if url = search(message[:keyword])
          message.reply(url)
        end
      end

      private

      def search(query)
        Ellen::GoogleImage::Client.new(query: query).get
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ellen-google_image-0.0.6 lib/ellen/handlers/google_image.rb