diff options
author | Casey Link <unnamedrambler@gmail.com> | 2008-06-30 20:21:53 -0400 |
---|---|---|
committer | Casey Link <unnamedrambler@gmail.com> | 2008-07-03 11:26:37 -0400 |
commit | 1d066955296f137ca0ef16335033ac2867aecc11 (patch) | |
tree | c73e2ba03dab86ff40f1658bc4cce834b9ed5aef | |
parent | c79e50cc70c10d3be0d3594924cabd22780566bc (diff) |
lastfm.rb plugin: a minor bugfix and additional error handling case.
-rw-r--r-- | data/rbot/plugins/lastfm.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index 45280d2f..05d9df41 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -210,6 +210,9 @@ class LastFmPlugin < Plugin end end now = artist = track = albumtxt = date = nil + unless doc.root.elements["recenttracks"].has_elements? + m.reply _("%{u} hasn't played anything recently") % {:u => user} + end first = doc.root.elements[1].elements[1] now = first.attributes["nowplaying"] artist = first.elements["artist"].text @@ -231,7 +234,7 @@ class LastFmPlugin < Plugin verb = @registry["#{m.sourcenick}_verb_past"] end ago = Utils.timeago(past) - m.reply _("%{u} is %{v} to \"%{t}\" by %{a} %{b}%{p}") % {:u => user, :v => verb, :t => track, :a => artist, :b => album, :p => ago} + m.reply _("%{u} %{v} to \"%{t}\" by %{a} %{b}%{p}") % {:u => user, :v => verb, :t => track, :a => artist, :b => album, :p => ago} end end |