def handle_set(m, params)
key = params[:key].to_s.intern
value = params[:value].join(" ")
unless @bot.config.items.has_key?(key)
m.reply _("no such config key %{key}") % {:key => key} unless params[:silent]
return false
end
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}: %{error}") % {:key => key, :error => 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") unless params[:silent]
return :restart
elsif @bot.config.items[key].requires_rescan
m.reply _("this config change will take effect on the next rescan") unless params[:silent]
return :rescan
else
m.okay unless params[:silent]
return true
end
end