Class: Botbckt::Google
- Defined in:
- lib/botbckt/commands/google.rb
Overview
Sends a query to Google via the JSON API and returns output in-channel:
< user> ~google ruby
< botbckt> First out of 93900000 results:
< botbckt> Ruby Programming Language
< botbckt> http://www.ruby-lang.org/
Inspired by Clojurebot: github.com/hiredman/clojurebot
Instance Method Summary collapse
Methods inherited from Command
create!, #get, #increment!, #say, say, #set, trigger
Methods included from Utilities
Instance Method Details
#call(sender, channel, query) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/botbckt/commands/google.rb', line 16 def call(sender, channel, query) result = google(query) say "First out of #{result.first} results:", channel say result.last['titleNoFormatting'], channel say result.last['unescapedUrl'], channel end |