diff options
author | dmitry kim <jason@nichego.net> | 2008-09-05 22:42:00 +0400 |
---|---|---|
committer | dmitry kim <jason@nichego.net> | 2008-09-05 22:42:38 +0400 |
commit | c72fab43b09a17aee353f8c11439c96ad71796dc (patch) | |
tree | 89b562c6e0eaa1428c306c9f5b3c18fcd73ef61a /data | |
parent | 107f1de91b246fbacbe7ad9de1281d0c25831e89 (diff) |
+ plugins/games/quiz: '!quiz stop' command implemented
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/games/quiz.rb | 19 |
1 files changed, 17 insertions, 2 deletions
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' |