lib/lita/robot.rb in lita-0.0.1 vs lib/lita/robot.rb in lita-1.0.0
- old
+ new
@@ -11,24 +11,35 @@
Lita.handlers.each { |handler| handler.dispatch(self, message) }
end
def run
@adapter.run
+ rescue Interrupt
+ shut_down
end
def send_messages(target, *strings)
@adapter.send_messages(target, strings.flatten)
end
alias_method :send_message, :send_messages
+ def set_topic(target, topic)
+ @adapter.set_topic(target, topic)
+ end
+
+ def shut_down
+ @adapter.shut_down
+ end
+
private
def load_adapter
adapter_name = Lita.config.robot.adapter
adapter_class = Lita.adapters[adapter_name.to_sym]
unless adapter_class
- raise UnknownAdapterError.new("Unknown adapter: :#{adapter_name}")
+ Lita.logger.fatal("Unknown adapter: :#{adapter_name}.")
+ abort
end
@adapter = adapter_class.new(self)
end
end