From 64cc3ddcea4c6c45298d6e5e65f6b0c74e4d9b0a Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 14 Apr 2014 14:18:01 -0700 Subject: Load/unload modules via admin commands. --- dinobot.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dinobot.rb') diff --git a/dinobot.rb b/dinobot.rb index 4828aac..052bb10 100644 --- a/dinobot.rb +++ b/dinobot.rb @@ -47,7 +47,7 @@ module Dinobot begin parse_line(str) rescue => e - puts "== Error parsing line. (#{e})" + puts "!! Error parsing line. (#{e})" end end @@ -77,10 +77,12 @@ module Dinobot def exec_commands(commands) commands.each do |command| + puts "== Executing command: #{command.inspect}" + case command.first when :say send(*command) if command.length == 3 - when :join, :part + when :join, :part, :load_module, :unload_module send(*command) if command.length == 2 end end @@ -122,7 +124,7 @@ module Dinobot puts "== Loaded module: #{mod} (#{m})" rescue LoadError, StandardError => e - puts "== Failed to load module: #{mod} (#{e})" + puts "!! Failed to load module: #{mod} (#{e})" end end @@ -131,7 +133,7 @@ module Dinobot puts "== Unloading module: #{mod}" unless @modules.has_key?(mod) - puts "== Failed to unload module: #{mod} (module not loaded)" + puts "!! Failed to unload module: #{mod} (module not loaded)" return end -- cgit v1.2.3-70-g09d2