From c1e2f3a2f2ada21d19b893795bd4d7d58962f8b6 Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Fri, 24 Apr 2020 22:44:42 +0200 Subject: [PATCH 1/1] plugin(keywords): remove export to file, see #42 --- data/rbot/plugins/keywords.rb | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/data/rbot/plugins/keywords.rb b/data/rbot/plugins/keywords.rb index da320780..ecb6cca8 100644 --- a/data/rbot/plugins/keywords.rb +++ b/data/rbot/plugins/keywords.rb @@ -325,8 +325,6 @@ class Keywords < Plugin case plugin when /keyword/ case topic - when 'export' - 'keyword export => exports definitions to keyword_factoids.rbot' when 'stats' 'keyword stats => show statistics about static facts' when 'wipe' @@ -474,41 +472,11 @@ class Keywords < Plugin m.reply "done" end - # export keywords to factoids file - def keyword_factoids_export - ar = Array.new - - debug @keywords.keys - - @keywords.each { |k, val| - next unless val - kw = Keyword.restore(val) - ar |= kw.to_factoids(k) - } - - # TODO check factoids config - # also TODO: runtime export - dir = @bot.path 'factoids' - fname = File.join(dir,"keyword_factoids.rbot") - - Dir.mkdir(dir) unless FileTest.directory?(dir) - Utils.safe_save(fname) do |file| - file.puts ar - end - end - # privmsg handler def privmsg(m) case m.plugin when "keyword" case m.params - when /^export$/ - begin - keyword_factoids_export - m.okay - rescue - m.reply _("failed to export keywords as factoids (%{err})" % {:err => $!}) - end when /^set\s+(.+?)\s+(is|are)\s+(.+)$/ keyword_command(m, $1, $2, $3) if @bot.auth.allow?('keycmd', m.source, m.replyto) when /^forget\s+(.+)$/ -- 2.39.2