From 55a181ae469ea60c6a553de6b0ab999a3591d6f2 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 3 Feb 2011 10:26:10 +0100 Subject: quiz: autoask cleanup --- data/rbot/plugins/games/quiz.rb | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'data') diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index 208846ed..3537680d 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -731,19 +731,26 @@ class QuizPlugin < Plugin params[:enable] ||= 'status' + reg = q.registry_conf + case params[:enable].downcase when "on", "true" - q.registry_conf["autoask"] = true + reg["autoask"] = true m.reply "Enabled autoask mode." + reg["autoask_delay"] = 0 unless reg.has_key("autoask_delay") cmd_quiz( m, nil ) if q.question == nil when "off", "false" - q.registry_conf["autoask"] = false + reg["autoask"] = false m.reply "Disabled autoask mode." when "status" - m.reply _("Autoask is %{status}, the delay is %{time}") % { - :status => q.registry_conf["autoask"], - :time => Utils.secs_to_string(q.registry_conf["autoask_delay"]), - } + if reg.has_key? "autoask" + m.reply _("autoask is %{status}, the delay is %{time}") % { + :status => reg["autoask"], + :time => Utils.secs_to_string(reg["autoask_delay"]), + } + else + m.reply _("autoask is not configured here") + end else m.reply "Invalid autoask parameter. Use 'on' or 'off' to set it, 'status' to check the current status." end @@ -756,7 +763,7 @@ class QuizPlugin < Plugin delay = params[:time].to_i q.registry_conf["autoask_delay"] = delay - m.reply "Autoask delay now #{q.registry_conf['autoask_delay']} seconds" + m.reply "autoask delay now #{q.registry_conf['autoask_delay']} seconds" end def cmd_transfer( m, params ) -- cgit v1.2.3