]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/alias.rb
reaction plugin: no more :stuff, but :before and :after for the pre and postmatch...
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / alias.rb
index 581cde1fb52643dbb9dd0f67970beb0ad21e46b6..1496755d099dd8db3d51005afb14940d737d2a8f 100644 (file)
@@ -44,15 +44,16 @@ class AliasPlugin < Plugin
     @data_file = "#{@data_path}/aliases.yaml"
     # hash of alias => command entries
     data = nil
-    @aliases = if File.exist?(@data_file) &&
-                  (data = YAML.load_file(@data_file)) &&
-                  data.respond_to?(:each_pair)
-                 data
-               else
-                 warning _("Data file is not found or corrupt, reinitializing data")
-                 Hash.new
+    aliases = if File.exist?(@data_file) &&
+                 (data = YAML.load_file(@data_file)) &&
+                 data.respond_to?(:each_pair)
+                data
+              else
+                warning _("Data file is not found or corrupt, reinitializing data")
+                Hash.new
                end
-    @aliases.each_pair do |a, c|
+    @aliases = Hash.new
+    aliases.each_pair do |a, c|
       begin
         add_alias(a, c)
       rescue AliasDefinitionError