From 0794897ba2e4b7f32b271bda7291999f313f99e7 Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Fri, 17 Apr 2020 23:13:32 +0200 Subject: plugin(lart): fix not save before load --- data/rbot/plugins/lart.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3