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

- old
+ new

@@ -10,12 +10,13 @@ @bot = bot create_database("stats.yml", Hash.new, :stats) end def call(connection, message) - if on_channel?(message) - if (plus_for = match?(message, :regexp => /^([^\s]*) \+1/, :position => 1)) + on_channel(message) do + match(message, /^([^\s]*) \+1/) do |plus_for| + plus_for = plus_for[1] plus_for.gsub!(":","") if filter(plus_for, message.nick) connection.msg(message.channel, "#{message.nick} pisze w PHP") and return end @@ -23,10 +24,10 @@ @stats[plus_for] ||= 0 @stats[plus_for] += 1 save end - if match?(message, :regexp => /^!stats$/, :position => 0) + match(message, /^!stats$/) do connection.msg(message.channel, print) end end end