From 6ff901dfe723b58ad13a2e3693473d934f5751b2 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 21 Apr 2014 12:17:58 -0700 Subject: Modify modules to accept MessageInfo objects. --- dinobot.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'dinobot.rb') diff --git a/dinobot.rb b/dinobot.rb index 657a374..0826a51 100644 --- a/dinobot.rb +++ b/dinobot.rb @@ -137,22 +137,21 @@ module Dinobot mod = mod.intern if m.response.empty? - m.response = @modules[mod].call(m.user, m.channel, command) + @modules[mod].call(m, command) else ensure_valid_response(m.response) - response = [] - m.response.each do |x| + prev = m.response + m.response = [] + + prev.each do |x| if x.first == :say - tmp = @modules[mod].call(m.user, x[1], "#{command} #{x[2]}") - ensure_valid_response(tmp) - response.concat(tmp) + @modules[mod].call(m, "#{command} #{x[2]}") + ensure_valid_response(m.response) else - response << x + m.response << x end end - - m.response = response end exec_command(m, remainder) if remainder -- cgit v1.2.3-70-g09d2