Sha256: 8abac665eba6244d09f95d9aacf1bc88e8000486475c7022d0dd93f4d0534534
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module Lita # A namespace to hold all subclasses of {Handler}. module Handlers # Provides information about the currently running robot. class Info < Handler route(/^info$/i, :chat, command: true, help: { "info" => t("help.info_value") }) http.get "/lita/info", :web # Replies with the current version of the Lita. # @param response [Lita::Response] The response object. # @return [void] # @since 3.0.0 def chat(response) response.reply "Lita #{Lita::VERSION} - http://www.lita.io/" end # Returns JSON with basic information about the robot. # @param request [Rack::Request] The HTTP request. # @param response [Rack::Response] The HTTP response. # @return [void] def web(_request, response) response.headers["Content-Type"] = "application/json" json = MultiJson.dump( lita_version: Lita::VERSION, adapter: Lita.config.robot.adapter, robot_name: robot.name, robot_mention_name: robot.mention_name ) response.write(json) end end Lita.register_handler(Info) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-3.2.0 | lib/lita/handlers/info.rb |