From f891f1f39db461392c0e6074fadc688647886ea7 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 26 Jul 2006 15:34:29 +0000 Subject: 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 --- lib/rbot/plugins.rb | 10 +++++++--- 1 file 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" -- cgit v1.2.3