summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-02-03 10:26:10 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-02-03 10:26:10 +0100
commit55a181ae469ea60c6a553de6b0ab999a3591d6f2 (patch)
tree1210c5b8e60da038a08c431a3e435e900fcb7af9 /data/rbot
parent7dbb7be418b2cf5c3587218210e3f22e4e1dbdb3 (diff)
quiz: autoask cleanup
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/games/quiz.rb21
1 files changed, 14 insertions, 7 deletions
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 )