From c72fab43b09a17aee353f8c11439c96ad71796dc Mon Sep 17 00:00:00 2001 From: dmitry kim Date: Fri, 5 Sep 2008 22:42:00 +0400 Subject: + plugins/games/quiz: '!quiz stop' command implemented --- data/rbot/plugins/games/quiz.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index a9ceddaf..7577e7ce 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -930,9 +930,23 @@ class QuizPlugin < Plugin end -end - + def stop(m, params) + unless m.public? + m.reply 'you must be on some channel to use this command' + return + end + if @quizzes.delete m.channel + @ask_mutex.synchronize do + t = @waiting.delete(m.channel) + @bot.timer.remove t if t + end + m.okay + else + m.reply(_("there is no active quiz on #{m.channel}")) + end + end +end plugin = QuizPlugin.new plugin.default_auth( 'edit', false ) @@ -950,6 +964,7 @@ plugin.map 'quiz refresh', :action => 'cmd_refresh' plugin.map 'quiz top5', :action => 'cmd_top5' plugin.map 'quiz top :number', :action => 'cmd_top_number' plugin.map 'quiz stats', :action => 'cmd_stats' +plugin.map 'quiz stop', :action => :stop # Admin commands plugin.map 'quiz autoask :enable', :action => 'cmd_autoask', :auth_path => 'edit' -- cgit v1.2.3