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

    def initialize
      @commands = [:commands]
    end

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

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

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