# File rbot/plugins/karma.rb, line 2 def initialize super # this plugin only wants to store ints! class << @registry def store(val) val.to_i end def restore(val) val.to_i end end @registry.set_default(0) # import if old file format found if(File.exist?("#{@bot.botclass}/karma.rbot")) puts "importing old karma data" IO.foreach("#{@bot.botclass}/karma.rbot") do |line| if(line =~ /^(\S+)<=>([\d-]+)$/) item = $1 karma = $2.to_i @registry[item] = karma end end File.delete("#{@bot.botclass}/karma.rbot") end end