summaryrefslogtreecommitdiffstats
path: root/modules/Help.rb
blob: 7c276890c88a804e2f78ee1b50971a0c00b5f86f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'xmpp4r/message'

require_relative '../module_base'

module Lain
  module Modules
    class Help < Base
      def on_message(muc, message)
        return unless /\A!help\b/ =~ message.body

        muc.send(Jabber::Message.new(muc.room, "Commands:" + @lain.commands.reduce('') { |s, cmd| "#{s}\n#{cmd[0]}: #{cmd[1]}" }))
      end

      def commands
        {
          '!help' => 'show this help'
        }
      end
    end
  end
end