aboutsummaryrefslogtreecommitdiff
path: root/module/test.rb
blob: f72893095780f68aedb114c223aa40a753388d65 (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
45
46
require_relative 'base'

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

        @commands << :echo << :ping << :x3 << :fooify
        @commands << :error << :timeout << :wrongreturn << :invalidmethods
      end

      def echo(user, channel, argument)
        [[:say, channel, argument]]
      end

      def ping(user, channel, argument)
        [[:say, channel, 'pong']]
      end

      def x3(user, channel, argument)
        [[:say, channel, argument]] * 3
      end

      def fooify(user, channel, argument)
        [[:say, channel, 'foo' + argument]]
      end

      def error(user, channel, argument)
        x
      end

      def timeout(user, channel, argument)
        sleep 60
      end

      def wrongreturn(user, channel, argument)
        0
      end

      def invalidmethods(user, channel, argument)
        [[:say, channel]]
      end
    end
  end
end