Sha256: c0f17e38236a7e5890a6c587646ea7f538c685cbdc8b50d45595c47639538537

Contents?: true

Size: 975 Bytes

Versions: 7

Compression:

Stored size: 975 Bytes

Contents

module SlackRubyBot
  module Commands
    class HelpCommand < Base
      help do
        title 'help'
        desc 'Shows help information.'
      end

      command 'help' do |client, data, match|
        command = match[:expression]

        text = if command.present?
                 CommandsHelper.instance.command_full_desc(command)
               else
                 general_text
               end

        client.say(channel: data.channel, text: text, gif: 'help')
      end

      class << self
        private

        def general_text
          bot_desc = CommandsHelper.instance.bot_desc_and_commands
          other_commands_descs = CommandsHelper.instance.other_commands_descs
          <<TEXT
#{bot_desc.join("\n")}

*Other commands:*
#{other_commands_descs.join("\n")}

For getting description of the command use: *help <command>*

For more information see https://github.com/slack-ruby/slack-ruby-bot, please.
TEXT
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
slack-ruby-bot-0.10.5 lib/slack-ruby-bot/commands/help.rb
slack-ruby-bot-0.10.4 lib/slack-ruby-bot/commands/help.rb
slack-ruby-bot-0.10.3 lib/slack-ruby-bot/commands/help.rb
slack-ruby-bot-0.10.2 lib/slack-ruby-bot/commands/help.rb
slack-ruby-bot-0.10.1 lib/slack-ruby-bot/commands/help.rb
slack-ruby-bot-0.10.0 lib/slack-ruby-bot/commands/help.rb
slack-ruby-bot-0.9.0 lib/slack-ruby-bot/commands/help.rb