From 36dba6af1f2d19c89e144b46acfbca8e1a40b756 Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Sun, 22 Feb 2009 18:24:01 +0200 Subject: seen: show what user said or did before leaving --- data/rbot/plugins/seen.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'data/rbot/plugins') diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index 078ed94a..12d0fae2 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -106,6 +106,35 @@ class SeenPlugin < Plugin when :TOPIC ret << "changing the topic of #{saw.where} to #{saw.message}" end + + case saw.type.to_sym + when :PART, :QUIT + before = reg.first + if before.type == "PUBLIC" || before.type == "ACTION" + time_diff = saw.time - before.time + if time_diff < 300 + time = "a moment" + elsif time_diff < 3600 + time = "a while" + else + return ret + end + + ret << ' and %{time} before' % { :time => time } + + if before.type == "PUBLIC" + ret << ' saying "%{message}"' % { + :message => before.message + } + elsif before.type == "ACTION" + ret << ' doing *%{message}*' % { + :nick => saw.nick, + :message => before.message + } + end + end + end + return ret end def store(m, saw) -- cgit v1.2.3