diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/lart.rb | 12 | ||||
-rw-r--r-- | data/rbot/plugins/salut.rb | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index 435ed04d..77c09882 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -42,23 +42,35 @@ class LartPlugin < Plugin @lartfile = nil @praisefile = nil super + end def set_language(lang) save @lartfile = "#{@bot.botclass}/lart/larts-#{lang}" @praisefile = "#{@bot.botclass}/lart/praises-#{lang}" + # We may be on an old installation, so on the first run read non-language-specific larts + @bulart = "#{@bot.botclass}/lart/larts" + @bupraise = "#{@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| + @larts << line.chomp + } end if File.exists? @praisefile IO.foreach(@praisefile) { |line| @praises << line.chomp } + elsif File.exists? @bupraise + IO.foreach(@bupraise) { |line| + @praises << line.chomp + } end end diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index 1a301b43..48276019 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -137,6 +137,10 @@ class SalutPlugin < Plugin end
def load_lang(lang)
+ dir = "#{@bot.botclass}/salut"
+ if not File.exist?(dir)
+ Dir.mkdir(dir)
+ end
file = "#{@bot.botclass}/salut/salut-#{lang}"
if File.exist?(file)
begin
|