aboutsummaryrefslogtreecommitdiff
path: root/module/base.rb
blob: b8be30648fe10992b76d614b97b8a15c8334167a (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
module Dinobot
  module Module
    class Base
      attr_accessor :commands

      def initialize(bot)
        @bot = bot

        @commands = [:commands]
      end

      def call(user, channel, message)
        command, argument = message.split(' ', 3)[1..2]

        if @commands.map { |x| x.to_s }.include?(command)
          send(command, user, channel, argument)
        end
      end

      def commands(user, channel, argument)
        [[:say, channel, "Commands: #{@commands.sort.join(' ')}"]]
      end
    end
  end
end