lib/lita/handlers/onewheel_duckduckgo.rb in lita-onewheel-duckduckgo-0.0.0 vs lib/lita/handlers/onewheel_duckduckgo.rb in lita-onewheel-duckduckgo-0.0.1

- old
+ new

@@ -8,10 +8,15 @@ def search(response) query = response.matches[0][0] Lita.logger.debug "Querying for #{query}" result = get_result(query) Lita.logger.debug "Result: #{result}" - reply = "DuckDuckGo Result: #{result['Abstract'][0..250]}" + reply = 'DuckDuckGo Result: ' + if result['Abstract'].empty? + reply += result['AbstractURL'] + else + reply += result['Abstract'][0..250] + end Lita.logger.debug "Reply: #{reply}" response.reply reply end def get_result(query)