diff options
author | David Gadling <dave@toasterwaffles.com> | 2010-03-23 11:24:52 -0700 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-07-01 15:10:59 +0200 |
commit | e39257443efc53bf378a971468969fb83f92b31a (patch) | |
tree | 40a782963f509264b6d7f9e95bb47d27d578b799 /data/rbot/plugins | |
parent | 98c6a8359d88c89c78faf74aa12994bd713d24c8 (diff) |
seen: Ignore garbage phrases as a users last words.
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r-- | data/rbot/plugins/seen.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index 84a2486e..717721e2 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -30,6 +30,9 @@ class SeenPlugin < Plugin Config.register Config::IntegerValue.new('seen.max_results', :default => 3, :validate => Proc.new{|v| v >= 0}, :desc => _("Maximum number of seen users to return in search (0 = no limit).")) + Config.register Config::ArrayValue.new('seen.ignore_patterns', + :default => [ "^no u$" ], + :desc => _("Strings/regexes that you'd like to ignore for 'last message' purposes")) def help(plugin, topic="") _("seen <nick> => have you seen, or when did you last see <nick>") @@ -67,6 +70,10 @@ class SeenPlugin < Plugin case m when PrivMessage return if m.private? + @bot.config['seen.ignore_patterns'].each { |regex| + return if m.message =~ /#{regex}/ + } + type = m.action? ? 'ACTION' : 'PUBLIC' store m, Saw.new(m.sourcenick.dup, now, type, m.target.to_s, m.message.dup) |