3 # container for bot configuration
4 # just treat it like a hash
7 # bot:: parent bot class
8 # create a new config hash from #{botclass}/conf.rbot
13 self["SERVER"] = "localhost"
16 self["USER"] = "gilbertt"
17 self["LANGUAGE"] = "english"
18 self["SAVE_EVERY"] = "60"
19 self["KEYWORD_LISTEN"] = false
20 if(File.exist?("#{@bot.botclass}/conf.rbot"))
21 IO.foreach("#{@bot.botclass}/conf.rbot") do |line|
22 next if(line =~ /^\s*#/)
23 if(line =~ /(\S+)\s+=\s+(.*)$/)
30 # write current configuration to #{botclass}/conf.rbot
32 Dir.mkdir("#{@bot.botclass}") if(!File.exist?("#{@bot.botclass}"))
33 File.open("#{@bot.botclass}/conf.rbot", "w") do |file|
34 self.each do |key, value|
35 file.puts "#{key} = #{value}"