From ef4d643889556a58f989a0d72278c81218036292 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 23 Jan 2007 16:46:28 +0000 Subject: More lart plugins cleanup --- data/rbot/plugins/lart.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index 69a9e8cc..2f470c96 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -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 -- cgit v1.2.3