X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Fquiz.rb;h=b139c66a2fad25eb2ec8c9c0e31900ce2f0307a3;hb=452e323bfdb73d6b93ab96f5fc417891e4aa8f53;hp=96e2ad402e520f3d30c552a890a184d4cd6edef4;hpb=ffef050dd341254f66fb08a2cdcef4894f36483e;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index 96e2ad40..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 ) @@ -300,7 +316,17 @@ class QuizPlugin < Plugin def help( plugin, topic="" ) if topic == "admin" - "Quiz game aministration commands (requires authentication): 'quiz autoask ' => enable/disable autoask mode. 'quiz autoask delay ' => delay next quiz by seconds when in autoask mode. 'quiz transfer [score] [jokers]' => transfer [score] points and [jokers] jokers from to (default is entire score and all jokers). 'quiz setscore ' => set 's score to . 'quiz setjokers ' => set 's number of jokers to . 'quiz deleteplayer ' => delete one player from the rank table (only works when score and jokers are set to 0). 'quiz cleanup' => remove players with no points and no jokers." + _("Quiz game aministration commands (requires authentication): ") + [ + _("'quiz autoask ' => enable/disable autoask mode"), + _("'quiz autoask delay