Class: Cinch::Plugins::Miwiki

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/miwiki.rb

Instance Method Summary collapse

Instance Method Details

#execute(m, search) ⇒ Object


10
11
12
13
14
15
16
# File 'lib/cinch/plugins/miwiki.rb', line 10

def execute(m, search)
  miyuki = Wikipedia.new
  excerpt = miyuki.fetch(search)
  m.reply "#{Format(:bold, excerpt.title)}\n#{excerpt.summary}¶\n#{excerpt.title_to_url}"
rescue => e
 m.reply "#{Format(:pink, :bold, 'Uhoh!')} · #{e.message}" 
end