aboutsummaryrefslogtreecommitdiff
path: root/module/test.rb
blob: 69bb8882b7cd07dbc048fd313382fee6ebbd3e75 (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.respond [:say, m.channel, args]
      end

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

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

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

      def error(m, args)
        x
      end

      def timeout(m, args)
        sleep 60
      end

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