]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/message.rb
core/userdata: with_botdata method
[user/henk/code/ruby/rbot.git] / lib / rbot / message.rb
index 6331825de66d512df0cb21da9c65d35be9adc2fa..9881503c3f10a074a7f8ff0aff4ae988dadbe69b 100644 (file)
@@ -4,20 +4,27 @@
 # :title: IRC message datastructures
 
 module Irc
-  BotConfig.register BotConfigArrayValue.new('core.address_prefix',
-    :default => [], :wizard => true,
-    :desc => "what non nick-matching prefixes should the bot respond to as if addressed (e.g !, so that '!foo' is treated like 'rbot: foo')"
-  )
 
-  BotConfig.register BotConfigBooleanValue.new('core.reply_with_nick',
-    :default => false, :wizard => true,
-    :desc => "if true, the bot will prepend the nick to what he has to say when replying (e.g. 'markey: you can't do that!')"
-  )
 
-  BotConfig.register BotConfigStringValue.new('core.nick_postfix',
-    :default => ':', :wizard => true,
-    :desc => "when replying with nick put this character after the nick of the user the bot is replying to"
-  )
+  class Bot
+    module Config
+      Config.register ArrayValue.new('core.address_prefix',
+        :default => [], :wizard => true,
+        :desc => "what non nick-matching prefixes should the bot respond to as if addressed (e.g !, so that '!foo' is treated like 'rbot: foo')"
+      )
+
+      Config.register BooleanValue.new('core.reply_with_nick',
+        :default => false, :wizard => true,
+        :desc => "if true, the bot will prepend the nick to what he has to say when replying (e.g. 'markey: you can't do that!')"
+      )
+
+      Config.register StringValue.new('core.nick_postfix',
+        :default => ':', :wizard => true,
+        :desc => "when replying with nick put this character after the nick of the user the bot is replying to"
+      )
+    end
+  end
+
 
   # Define standard IRC attriubtes (not so standard actually,
   # but the closest thing we have ...)
@@ -167,7 +174,7 @@ module Irc
     # Access the botuser corresponding to the source, if any
     #
     def botuser
-      @bot.auth.autologin(@source) rescue @bot.auth.everyone
+      source.botuser rescue @bot.auth.everyone
     end