diff options
Diffstat (limited to 'lib/rbot/plugins.rb')
-rw-r--r-- | lib/rbot/plugins.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 7631bfc3..567724f8 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -822,6 +822,21 @@ module Plugins return false # debug "Finished delegating privmsg with key #{m.plugin.inspect}" end + + # delegate IRC messages, by delegating 'listen' first, and the actual method + # afterwards. Delegating 'privmsg' also delegates ctcp_listen and message + # as appropriate. + def irc_delegate(method, m) + delegate('listen', m) + if method.to_sym == :privmsg + delegate('ctcp_listen', m) if m.ctcp + delegate('message', m) + privmsg(m) if m.address? + delegate('unreplied', m) unless m.replied + else + delegate(method, m) + end + end end # Returns the only PluginManagerClass instance |