From da4d97f0652bddcee269b6d99863f21a1021056c Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 15 Feb 2007 13:58:15 +0000 Subject: [PATCH] New unreplied() method for plugins that want to handle PRIVMSGs unreplied by any other plugin. Use it in the keywords plugin --- ChangeLog | 5 +++++ data/rbot/plugins/keywords.rb | 4 ++-- lib/rbot/ircbot.rb | 3 +++ lib/rbot/plugins.rb | 5 ++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d3a7258..4655e5ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-15 Giuseppe Bilotta + + * Plugin: new unreplied() method to handle PRIVMSGs which have not + been replied to. + 2007-02-12 Giuseppe Bilotta * Remote Service Provider: from an idea by halorgium , diff --git a/data/rbot/plugins/keywords.rb b/data/rbot/plugins/keywords.rb index 0c1b3526..855bfe6a 100644 --- a/data/rbot/plugins/keywords.rb +++ b/data/rbot/plugins/keywords.rb @@ -489,8 +489,8 @@ class Keywords < Plugin end end - def listen(m) - return if m.address? + def unreplied(m) + # return if m.address? # in channel message, not to me # TODO option to do if(m.message =~ /^(.*)$/, ie try any line as a # keyword lookup. diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index ed435fb4..0ef6b1de 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -498,6 +498,9 @@ class IrcBot unless ignored @plugins.delegate "listen", m @plugins.privmsg(m) if m.address? + if not m.replied + @plugins.delegate "unreplied", m + end end } @client[:notice] = proc { |data| diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 564495e0..e101e627 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -61,11 +61,14 @@ module Plugins etc. privmsg(PrivMessage):: - called for a PRIVMSG if the first word matches one + Called for a PRIVMSG if the first word matches one the plugin register()d for. Use m.plugin to get that word and m.params for the rest of the message, if applicable. + unreplied(PrivMessage):: + Called for a PRIVMSG which has not been replied to. + kick(KickMessage):: Called when a user (or the bot) is kicked from a channel the bot is in. -- 2.39.2