X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fspotify.rb;h=29331c00ad94fc4d0f8656db0397c9964d78c327;hb=fe6ae0ecaf02182ac5404e7ace3c24b96a12ee9a;hp=f645a8afda9bf8e7dd907301a156798483d939bf;hpb=4fa049e0386d8044f0063e90b7e7efbca9c712de;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/spotify.rb b/data/rbot/plugins/spotify.rb index f645a8af..29331c00 100644 --- a/data/rbot/plugins/spotify.rb +++ b/data/rbot/plugins/spotify.rb @@ -10,13 +10,25 @@ # 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 artist , spotify 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"