diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-04-21 12:17:58 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-04-21 12:17:58 -0700 |
commit | 6ff901dfe723b58ad13a2e3693473d934f5751b2 (patch) | |
tree | 010a86fccc8ec0fcef0256c7cc06516308cab92f /module/base.rb | |
parent | 6f983f20925e6c1b95649f221fb9fd419a44f025 (diff) | |
download | dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.gz dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.xz |
Modify modules to accept MessageInfo objects.
Diffstat (limited to 'module/base.rb')
-rw-r--r-- | module/base.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/module/base.rb b/module/base.rb index b8be306..3f4d9cd 100644 --- a/module/base.rb +++ b/module/base.rb @@ -9,16 +9,18 @@ module Dinobot @commands = [:commands] end - def call(user, channel, message) - command, argument = message.split(' ', 3)[1..2] + def call(m, command) + command, args = command.split(' ', 3)[1..2] + args ||= '' - if @commands.map { |x| x.to_s }.include?(command) - send(command, user, channel, argument) - end + return unless @commands.map { |x| x.to_s }.include?(command) + + send(command, m, args) end - def commands(user, channel, argument) - [[:say, channel, "Commands: #{@commands.sort.join(' ')}"]] + def commands(m, args) + m.response << [:say, m.channel, + "Commands: #{@commands.sort.join(' ')}"] end end end |