aboutsummaryrefslogtreecommitdiff
path: root/module.rb
blob: f0c415a4b51e723400529cb5734294636f6d7d35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Dinobot
  class Module
    attr_accessor :commands

    def initialize
      @commands = [:commands]
    end

    def call(user, channel, message)
      message = message.split(' ', 2).last
      command = message.split.first

      if @commands.include?(command.intern)
        send(command, user, channel, message)
      end
    end

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