summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaine Virta <rane@kapsi.fi>2009-02-22 18:24:01 +0200
committerRaine Virta <rane@kapsi.fi>2009-02-26 01:09:20 +0200
commit36dba6af1f2d19c89e144b46acfbca8e1a40b756 (patch)
treeef1ee9e4ca6f79bfb6a1bc1643f3025d8820ef13
parenteec8d96e5c8f0c44148cc97a40b75a57e399cf6e (diff)
seen: show what user said or did before leaving
-rw-r--r--data/rbot/plugins/seen.rb29
1 files changed, 29 insertions, 0 deletions
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)