X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Fquiz.rb;h=b139c66a2fad25eb2ec8c9c0e31900ce2f0307a3;hb=052217de30c59206d7025b582d4604557a747470;hp=f16d057fa2ec98f431c93b8a5b351dd01024fc06;hpb=f6b83f72f89d8789760bfaff7080123a1a6fb5de;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index f16d057f..b139c66a 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -175,6 +175,22 @@ class QuizPlugin < Plugin @ask_mutex = Mutex.new end + def cleanup + @ask_mutex.synchronize do + # purge all waiting timers + @waiting.each do |chan, t| + @bot.timer.remove t.first + @bot.say chan, _("stopped quiz timer") + end + @waiting.clear + end + chans = @quizzes.keys + @quizzes.clear + chans.each do |chan| + @bot.say chan, _("quiz stopped") + end + end + # Function that returns whether a char is a "separator", used for hints # def is_sep( ch )