X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Falias.rb;h=89be0020434b81e1593a40d573aa77db6a80592e;hb=6cf365c49ce5fbe24c0a4ff0663550390b501fea;hp=f947d81cf4221ad41e1241eca1185b21e2e08a32;hpb=52895a145e3327919b1a40647d4352bd2e9bc707;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/alias.rb b/data/rbot/plugins/alias.rb index f947d81c..89be0020 100644 --- a/data/rbot/plugins/alias.rb +++ b/data/rbot/plugins/alias.rb @@ -38,8 +38,8 @@ class AliasPlugin < Plugin def initialize super - @data_path = "#{@bot.botclass}/alias/" - @data_file = "#{@data_path}/aliases.yaml" + @data_path = datafile + @data_file = File.join(@data_path, 'aliases.yaml') # hash of alias => command entries data = nil aliases = if File.exist?(@data_file) && @@ -58,10 +58,10 @@ class AliasPlugin < Plugin warning _("Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}") % {:alias => a, :command => c, :filename => @data_file, :reason => $1} end - end - end + end + end - def save + def save FileUtils.mkdir_p(@data_path) Utils.safe_save(@data_file) {|f| f.write @aliases.to_yaml} end @@ -110,7 +110,7 @@ class AliasPlugin < Plugin command.scan(/<(\w+)>/).flatten.to_set == text.split.grep(/\A[:*](\w+)\Z/) {$1}.to_set or raise AliasDefinitionError.new(_('The arguments in alias must match the substitutions in command, and vice versa')) - + begin map text, :action => :"alias_handle<#{text}>", :auth_path => 'run' rescue