lib/lita/robot.rb in lita-2.5.0 vs lib/lita/robot.rb in lita-2.6.0
- old
+ new
@@ -20,10 +20,11 @@
def initialize
@name = Lita.config.robot.name
@mention_name = Lita.config.robot.mention_name || @name
@app = RackApp.new(self).to_app
load_adapter
+ trigger(:loaded)
end
# The primary entry point from the adapter for an incoming message.
# Dispatches the message to all registered handlers.
# @param message [Lita::Message] The incoming message.
@@ -64,12 +65,14 @@
# Gracefully shuts the robot down, stopping the web server and delegating
# to the adapter to perform any shut down tasks necessary for the chat
# service.
# @return [void]
def shut_down
+ trigger(:shut_down_started)
@server.stop if @server
@server_thread.join if @server_thread
@adapter.shut_down
+ trigger(:shut_down_complete)
end
# Triggers an event, instructing all registered handlers to invoke any
# methods subscribed to the event, and passing them a payload hash of
# arbitrary data.