lib/slack-ruby-bot/commands/base.rb in slack-ruby-bot-0.9.0 vs lib/slack-ruby-bot/commands/base.rb in slack-ruby-bot-0.10.0
- old
+ new
@@ -3,10 +3,17 @@
class Base
include Loggable
class_attribute :routes
class << self
+ attr_reader :command_classes
+
+ def inherited(subclass)
+ @command_classes ||= []
+ @command_classes << subclass
+ end
+
def send_message(client, channel, text, options = {})
logger.warn '[DEPRECATION] `send_message` is deprecated. Please use `client.say` instead.'
if text && !text.length.empty?
client.say(options.merge(channel: channel, text: text))
else
@@ -23,10 +30,10 @@
logger.warn '[DEPRECATION] `send_gif` is deprecated. Please use `client.say` instead.'
client.say(options.merge(channel: channel, text: '', gif: keywords))
end
def help(&block)
- CommandsHelper.instance.capture_help(name, &block)
+ CommandsHelper.instance.capture_help(self, &block)
end
def default_command_name
name && name.split(':').last.downcase
end