lib/muzang-plugins/muzang-nerdpursuit.rb in muzang-plugins-1.0.2 vs lib/muzang-plugins/muzang-nerdpursuit.rb in muzang-plugins-1.1.0

- old
+ new

@@ -60,12 +60,12 @@ def period(time) time # need for speed up tests end def call(connection, message) - if on_channel?(message) - if match?(message, :regexp => /^!quiz$/, :position => 0) + on_channel(message) do + match(message, /^!quiz$/) do quiz! connection.msg(message.channel, "Quiz time!") EM.add_timer(period(1)) { connection.msg(message.channel, "Category: #{current_question["category"]}") } EM.add_timer(period(2)) { connection.msg(message.channel, "Question: #{current_question["text"]}") } 4.times do |time| @@ -81,10 +81,11 @@ @winner = nil end_quiz! end end - if(answer = match?(message, :regexp => /\d/, :position => 0)) + match(message, /\d/) do |match| + answer = match[0] if @quiz_time unless @answers[message.nick] @answers[message.nick] = { :answer => answer, :time => Time.now } end end