Class: QbertBot::Core::Help

Inherits:
Object
  • Object
show all
Includes:
Plugin
Defined in:
lib/qbert_bot/core/help.rb

Instance Attribute Summary

Attributes included from Plugin

#bot, #router, #scheduler, #slack

Instance Method Summary collapse

Methods included from Plugin

included, plugins

Instance Method Details

#helpObject



6
7
8
9
10
# File 'lib/qbert_bot/core/help.rb', line 6

def help
  [
    ['help', 'Display all commands']
  ]
end

#registerObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/qbert_bot/core/help.rb', line 12

def register
  bot.hear(/^help$/) do |msg|
    commands = []
    bot.plugins.each do |plug|
      commands.concat plug.help.map{|i| i.join(' ')}
    end

    msg.reply "Available commands:\n#{commands.join("\n")}"
  end
end