Class: Cognition::Plugins::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/cognition/plugins/default.rb

Constant Summary

Constants inherited from Base

Base::RENDER_DEFAULTS

Instance Attribute Summary

Attributes inherited from Base

#bot, #matchers

Instance Method Summary collapse

Methods inherited from Base

definitions, inherited, #initialize, match, #render

Constructor Details

This class inherits a constructor from Cognition::Plugins::Base

Instance Method Details

#help(msg, match_data = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/cognition/plugins/default.rb', line 19

def help(msg, match_data = nil)
  type = msg.[:type] ||= "text"
  if match_data[:command].nil? || match_data[:command].empty?
    @help = bot.help.sort
  else
    @help = bot.help.find_all { |text| text.match match_data[:command] }
  end
  render(type: type)
end

#pongObject

rubocop:enable Lint/AmbiguousRegexpLiteral



15
16
17
# File 'lib/cognition/plugins/default.rb', line 15

def pong(*)
  "PONG"
end