]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
More lart plugins cleanup
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 23 Jan 2007 16:46:28 +0000 (16:46 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 23 Jan 2007 16:46:28 +0000 (16:46 +0000)
data/rbot/plugins/lart.rb

index 69a9e8cc26839e176f8be3e370ae7bd2064a483a..2f470c96d029d9c90058618e80dec80102cd5a12 100644 (file)
@@ -47,19 +47,23 @@ class LartPlugin < Plugin
 
   def set_language(lang)
     save
+
+    # We may be on an old installation, so on the first run read non-language-specific larts
+    unless defined?(@oldlart)
+      @oldlart = "#{@bot.botclass}/lart/larts"
+      @oldpraise = "#{@bot.botclass}/lart/praise"
+    end
+
     @lartfile.replace "#{@bot.botclass}/lart/larts-#{lang}"
     @praisefile.replace "#{@bot.botclass}/lart/praises-#{lang}"
-    # We may be on an old installation, so on the first run read non-language-specific larts
-    @bulart.replace "#{@bot.botclass}/lart/larts"
-    @bupraise.replace "#{@bot.botclass}/lart/praise"
     @larts.clear
     @praises.clear
     if File.exists? @lartfile
       IO.foreach(@lartfile) { |line|
         @larts << line.chomp
       }
-    elsif File.exists? @bulart
-      IO.foreach(@bulart) { |line|
+    elsif File.exists? @oldlart
+      IO.foreach(@oldlart) { |line|
         @larts << line.chomp
       }
     end
@@ -67,8 +71,8 @@ class LartPlugin < Plugin
       IO.foreach(@praisefile) { |line|
         @praises << line.chomp
       }
-    elsif File.exists? @bupraise
-      IO.foreach(@bupraise) { |line|
+    elsif File.exists? @oldpraise
+      IO.foreach(@oldpraise) { |line|
         @praises << line.chomp
       }
     end