diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-27 11:51:23 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-27 11:51:23 +0000 |
commit | d51861faa9607718870cea1acbbc0b2b2c2c7364 (patch) | |
tree | e3b0058b4690a8f440bed6a5b93d77219160ddaf /data | |
parent | d5c94ce03c4e0e5d8f888bef999471941048f682 (diff) |
Try to read old language-agnostic lart/praises if language-specific ones are not found
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
|