From: Giuseppe Bilotta Date: Sun, 24 May 2009 11:49:38 +0000 (+0200) Subject: seen plugin: check if there's a previous action before using it X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=c391125e75fe205056da8e7e0d31e988be37199a;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git seen plugin: check if there's a previous action before using it If the registry data is not an Array, there will be no 'before' information stored, so just use the normal output. --- diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index babf7484..0fc6f076 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -81,14 +81,16 @@ 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