summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authorMatthias Hecker <mail@apoc.cc>2020-04-17 23:13:32 +0200
committerMatthias Hecker <mail@apoc.cc>2020-04-17 23:13:32 +0200
commit0794897ba2e4b7f32b271bda7291999f313f99e7 (patch)
treeccd8d2ccc5d5bc61229c6a1482012066c506d777 /data/rbot/plugins
parente5ff70eece675e05e6cdd1e2740f1f7a1316c697 (diff)
plugin(lart): fix not save before load
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/lart.rb5
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