aboutsummaryrefslogtreecommitdiff
path: root/dinobot.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-21 12:17:58 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-21 12:17:58 -0700
commit6ff901dfe723b58ad13a2e3693473d934f5751b2 (patch)
tree010a86fccc8ec0fcef0256c7cc06516308cab92f /dinobot.rb
parent6f983f20925e6c1b95649f221fb9fd419a44f025 (diff)
downloaddinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.gz
dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.xz
Modify modules to accept MessageInfo objects.
Diffstat (limited to 'dinobot.rb')
-rw-r--r--dinobot.rb17
1 files changed, 8 insertions, 9 deletions
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