From: Matthias Hecker Date: Fri, 24 Apr 2020 20:44:42 +0000 (+0200) Subject: plugin(keywords): remove export to file, see #42 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=c1e2f3a2f2ada21d19b893795bd4d7d58962f8b6;hp=8218e3f05e8ccd95497dd3c7aa115cfde8b01a40;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git plugin(keywords): remove export to file, see #42 --- 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+(.+)$/