]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/seen.rb
spotify: handle errors
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / seen.rb
index 72ea92177e363d0109ad32346d8068cc91f78789..0fc6f0760f4dfcc91e8ac622f3e5f0fac3764c5c 100644 (file)
@@ -81,20 +81,22 @@ class SeenPlugin < Plugin
       reg.last
     end
 
-    before = reg.first
+    if reg.kind_of? Array
+      before = reg.first
+    end
 
     formats = {
       :normal      => _("%{nick} was last seen %{when}, %{doing}"),
       :with_before => _("%{nick} was last seen %{when}, %{doing} and %{time} before %{did_before}")
     }
 
-    if [:PART, :QUIT].include?(saw.type.to_sym) &&
+    if before && [:PART, :QUIT].include?(saw.type.to_sym) &&
        [:PUBLIC, :ACTION].include?(before.type.to_sym)
       did_before = case before.type.to_sym
       when :PUBLIC
         _("saying \"%{message}\"")
       when :ACTION
-        _("doing *%{message}*")
+        _("doing *%{nick} %{message}*")
       end % {
         :nick => saw.nick,
         :message => before.message
@@ -127,7 +129,7 @@ class SeenPlugin < Plugin
     when :PUBLIC
       _("saying \"%{message}\"")
     when :ACTION
-      _("doing %{nick} %{message}")
+      _("doing *%{message}*")
     when :NICK
       _("changing nick from %{nick} to %{message}")
     when :PART