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. --- module/test.rb | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'module/test.rb') 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 -- cgit v1.2.3-70-g09d2