Class: Plugins::UrbanDictionary
- Inherits:
-
Object
- Object
- Plugins::UrbanDictionary
- Includes:
- Cinch::Helpers, Cinch::Plugin
- Defined in:
- lib/Zeta/plugins/urban.rb
Instance Method Summary collapse
Methods included from Cinch::Plugin
Instance Method Details
#query(m, query) ⇒ Object
20 21 22 |
# File 'lib/Zeta/plugins/urban.rb', line 20 def query(m, query) m.reply "UD↦ #{search(query)}" end |
#wotd(m) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/Zeta/plugins/urban.rb', line 25 def wotd(m) url = URI.encode "http://www.urbandictionary.com/" doc = Nokogiri.HTML( # RestClient.get(url) open(url) ) word = doc.at_css('.word').text.strip[0..40] meaning = doc.at_css('.meaning').text.strip[0..450] + "... \u263A" m.reply "UD↦ #{word} -- #{meaning}" end |