]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/plugins.rb
Allow plugins to do things when the language is changed. Will be used e.g. by lart...
[user/henk/code/ruby/rbot.git] / lib / rbot / plugins.rb
index 8aa75d203f656790673b2abf4a9a826328e56c4e..66a7d84294778572ef7f3f2a53462cef379a279a 100644 (file)
@@ -88,6 +88,10 @@ module Plugins
   connect()::            Called when a server is joined successfully, but
                          before autojoin channels are joined (no params)
 
+  set_language(String)::
+                         Called when the user sets a new language
+                         whose name is the given String
+
   save::                 Called when you are required to save your plugin's
                          state, if you maintain data between sessions
 
@@ -111,6 +115,9 @@ module Plugins
       @registry = BotRegistryAccessor.new(@bot, self.class.to_s.gsub(/^.*::/, ""))
 
       @manager.add_botmodule(self)
+      if self.respond_to?('set_language')
+        self.set_language(@bot.lang.language)
+      end
     end
 
     def botmodule_class