diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-26 15:34:29 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-26 15:34:29 +0000 |
commit | f891f1f39db461392c0e6074fadc688647886ea7 (patch) | |
tree | d003953a1a53b6ffac7aa0ebd9fea2c2ad5e7f3b | |
parent | 08509c6649fc6c07b9ed4fddcdebcb70366ceef3 (diff) |
Provide a handle method for plugins, so that plugin creators can both use map and make their own privmsg method by calling handle(m) from within it
-rw-r--r-- | lib/rbot/plugins.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index c8f63f59..7a8213e4 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -112,6 +112,10 @@ module Plugins @registry.close end + def handle(m) + @handler.handle(m) + end + def map(*args) @handler.map(*args) # register this map @@ -119,7 +123,7 @@ module Plugins self.register name unless self.respond_to?('privmsg') def self.privmsg(m) - @handler.handle(m) + handle(m) end end end @@ -131,7 +135,7 @@ module Plugins self.register name, {:hidden => true} unless self.respond_to?('privmsg') def self.privmsg(m) - @handler.handle(m) + handle(m) end end end @@ -145,7 +149,7 @@ module Plugins # return a help string for your module. for complex modules, you may wish # to break your help into topics, and return a list of available topics if # +topic+ is nil. +plugin+ is passed containing the matching prefix for - # this message - if your plugin handles multiple prefixes, make sure your + # this message - if your plugin handles multiple prefixes, make sure you # return the correct help for the prefix requested def help(plugin, topic) "no help" |