aboutsummaryrefslogtreecommitdiff
path: root/module/test.rb
blob: cfc929b14478f3ecd20be76e2289976deb6fdab7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require_relative 'base'

module Dinobot
  module Module
    class Test < Base
      def initialize(bot)
        super

        @commands << :echo << :ping << :x3 << :fooify
        @commands << :error << :timeout << :invalidresponse
      end

      def echo(m, args)
        m.response << [:say, m.channel, args]
      end

      def ping(m, args)
        m.response << [:say, m.channel, 'pong']
      end

      def x3(m, args)
        3.times do
          m.response << [:say, m.channel, args]
        end
      end

      def fooify(m, args)
        m.response << [:say, m.channel, "foo#{args}"]
      end

      def error(m, args)
        x
      end

      def timeout(m, args)
        sleep 60
      end

      def invalidresponse(m, args)
        m.response << [:say, m.channel]
      end
    end
  end
end