Module: Zabbirc::Irc::Help

Extended by:
ActiveSupport::Concern
Included in:
PluginMethods
Defined in:
lib/zabbirc/irc/help.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

FEATURES =
{}

Instance Method Summary collapse

Instance Method Details

#help_featuresObject



7
8
9
# File 'lib/zabbirc/irc/help.rb', line 7

def help_features
  FEATURES
end

#zabbirc_help(m) ⇒ Object



11
12
13
14
15
16
# File 'lib/zabbirc/irc/help.rb', line 11

def zabbirc_help m
  op = authenticate m
  return unless op
  help = "#{op.nick}: Zabbirc - Zabbix IRC Bot - available commands: #{help_features.keys.join(", ")}. Type '!zabbirc help <command>' for detailed help"
  m.reply help
end

#zabbirc_help_detail(m, command) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/zabbirc/irc/help.rb', line 18

def zabbirc_help_detail m, command
  op = authenticate m
  return unless op
  if cmd_help = help_features[command]
    help = "HELP #{command}: #{cmd_help}"
  else
    help = "Uknown command: #{command}"
  end
  m.reply("#{op.nick}: #{help}")
end