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/test.rb | |
parent | 6f983f20925e6c1b95649f221fb9fd419a44f025 (diff) | |
download | dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.gz dinobot-6ff901dfe723b58ad13a2e3693473d934f5751b2.tar.xz |
Modify modules to accept MessageInfo objects.
Diffstat (limited to 'module/test.rb')
-rw-r--r-- | module/test.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/module/test.rb b/module/test.rb index f728930..cfc929b 100644 --- a/module/test.rb +++ b/module/test.rb @@ -7,39 +7,37 @@ module Dinobot super @commands << :echo << :ping << :x3 << :fooify - @commands << :error << :timeout << :wrongreturn << :invalidmethods + @commands << :error << :timeout << :invalidresponse end - def echo(user, channel, argument) - [[:say, channel, argument]] + def echo(m, args) + m.response << [:say, m.channel, args] end - def ping(user, channel, argument) - [[:say, channel, 'pong']] + def ping(m, args) + m.response << [:say, m.channel, 'pong'] end - def x3(user, channel, argument) - [[:say, channel, argument]] * 3 + def x3(m, args) + 3.times do + m.response << [:say, m.channel, args] + end end - def fooify(user, channel, argument) - [[:say, channel, 'foo' + argument]] + def fooify(m, args) + m.response << [:say, m.channel, "foo#{args}"] end - def error(user, channel, argument) + def error(m, args) x end - def timeout(user, channel, argument) + def timeout(m, args) sleep 60 end - def wrongreturn(user, channel, argument) - 0 - end - - def invalidmethods(user, channel, argument) - [[:say, channel]] + def invalidresponse(m, args) + m.response << [:say, m.channel] end end end |