diff options
author | Matthias Hecker <mail@apoc.cc> | 2020-04-17 23:13:32 +0200 |
---|---|---|
committer | Matthias Hecker <mail@apoc.cc> | 2020-04-17 23:13:32 +0200 |
commit | 0794897ba2e4b7f32b271bda7291999f313f99e7 (patch) | |
tree | ccd8d2ccc5d5bc61229c6a1482012066c506d777 | |
parent | e5ff70eece675e05e6cdd1e2740f1f7a1316c697 (diff) |
plugin(lart): fix not save before load
-rw-r--r-- | data/rbot/plugins/lart.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index cb8e57b7..17294055 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -53,7 +53,7 @@ class LartPlugin < Plugin @praises = @registry[:praises] # for migrations try to read lart from bot data first (this is usually in ~/.rbot/lart: - if not @larts or not @praises + if (not @larts or not @praises) and Dir.exists? datafile log "migrate existing larts or praises from #{datafile}" @larts = load_static_files(datafile, 'larts') @@ -80,8 +80,11 @@ class LartPlugin < Plugin end def save + return unless @larts + @registry[:larts] = @larts @registry[:praises] = @praises + @registry.flush end |