]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/spotify.rb
[core] unicode plugin that sets server encoding
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / spotify.rb
index f645a8afda9bf8e7dd907301a156798483d939bf..29331c00ad94fc4d0f8656db0397c9964d78c327 100644 (file)
 # License:: GPL v2
 
 class SpotifyPlugin < Plugin
+  def initialize
+    super
+
+    unless Object.const_defined?('Spotify')
+      raise 'Spotify module not found (lib_spotify plugin probably not enabled)'
+    end
+  end
+
   def help(plugin, topic)
     _("spotify plugin - usage: spotify <spotify>, spotify artist <artist>, spotify album <album>")
   end
 
   def search(m, params)
     method = params[:method] || 'track'
-    result = Spotify.search(method, params[:query].to_s)
+    begin
+      result = Spotify.search(method, params[:query].to_s)
+    rescue
+      m.reply "problems connecting to Spotify"
+    end
 
     if result.nil?
       m.reply "no results"