summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-01-30 14:13:37 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-01-30 14:13:37 +0000
commit4d6ba25863f52c4ecbbbb6cb6ff1dcb8acc49da3 (patch)
treebf461c1339d8f62a615f073bf09058daab802aad /lib/rbot
parent6c3293368ec1879fae2d7a5c4638aac42ee99b11 (diff)
Core botmodule config.rb has some (very little) facility to ease config key setting from other botmodules
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/core/config.rb19
1 files changed, 11 insertions, 8 deletions
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