From 4d6ba25863f52c4ecbbbb6cb6ff1dcb8acc49da3 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 30 Jan 2007 14:13:37 +0000 Subject: Core botmodule config.rb has some (very little) facility to ease config key setting from other botmodules --- lib/rbot/core/config.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib/rbot/core/config.rb') diff --git a/lib/rbot/core/config.rb b/lib/rbot/core/config.rb index 1fe2da22..9ef7ebee 100644 --- a/lib/rbot/core/config.rb +++ b/lib/rbot/core/config.rb @@ -66,22 +66,25 @@ class ConfigModule < CoreBotModule key = params[:key].to_s.intern value = params[:value].join(" ") unless @bot.config.items.has_key?(key) - m.reply "no such config key #{key}" - return + m.reply "no such config key #{key}" unless params[:silent] + return false end - return if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto) + return false if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto) begin @bot.config.items[key].set_string(value) rescue ArgumentError => e - m.reply "failed to set #{key}: #{e.message}" - return + m.reply "failed to set #{key}: #{e.message}" unless params[:silent] + return false end if @bot.config.items[key].requires_restart - m.reply "this config change will take effect on the next restart" + m.reply "this config change will take effect on the next restart" unless params[:silent] + return :restart elsif @bot.config.items[key].requires_rescan - m.reply "this config change will take effect on the next rescan" + m.reply "this config change will take effect on the next rescan" unless params[:silent] + return :rescan else - m.okay + m.okay unless params[:silent] + return true end end -- cgit v1.2.3