Class: Lita::Handlers::Genius
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Genius
- Defined in:
- lib/lita/handlers/genius.rb
Instance Method Summary collapse
Instance Method Details
#search(response) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lita/handlers/genius.rb', line 10 def search(response) query = response.matches.first.first songs = RapGenius.search(query) if !songs.empty? song = songs.first response.reply song.description.gsub(/\n+/, " ") response.reply "#{song.artist.name} - #{song.title} | http://genius.com/songs/#{song.id}" else response.reply "No songs found for '#{query}'" end end |