Sha256: dec91c1deeeba81efb5bdc3eb1b12661e9aec54ebc05b901a3280a27973dd60b

Contents?: true

Size: 465 Bytes

Versions: 8

Compression:

Stored size: 465 Bytes

Contents

require 'google-search'

# Responds with the first google image search result matching a query.
class Robut::Plugin::GoogleImages
  include Robut::Plugin

  desc "image <query> - responds with the first image from a Google Images search for <query>"
  match /^image (.*)/, :sent_to_me => true do |query|
    image = Google::Search::Image.new(:query => query).first

    if image
      reply image.uri
    else
      reply "Couldn't find an image"
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
sclemmer-robut-0.6.0 lib/robut/plugin/google_images.rb
sclemmer-robut-0.5.4 lib/robut/plugin/google_images.rb
sclemmer-robut-0.5.3 lib/robut/plugin/google_images.rb
sclemmer-robut-0.5.2 lib/robut/plugin/google_images.rb
robut-0.5.2 lib/robut/plugin/google_images.rb
robut-0.5.1 lib/robut/plugin/google_images.rb
robut-0.5.0 lib/robut/plugin/google_images.rb
robut-0.4.0 lib/robut/plugin/google_images.rb