class Pepito::Handlers::Info

Handler to give the bot’s info.

Public Instance Methods

chat(_source, _match_data) click to toggle source

Info for the chat @param _source [Pepito::Source] Source of the message. Not used. @param _match_data [MatchData] Match Data. Not used. @return [Array<String>]

# File lib/pepito/handlers/info.rb, line 33
def chat(_source, _match_data)
  strings = []
  strings << 'Pepito Version: ' + Pepito::VERSION
  strings
end
run() click to toggle source

Run the handler. @return [void]

# File lib/pepito/handlers/info.rb, line 12
def run
  http_route('GET', '/info', :web)
  chat_route(/^info$/i, :chat, command: true, help: "info -> show bot's info")
end
web(_request, response) click to toggle source

Info for the http api. @param _request [Rack::Request] @param response [Rack::Response] @return [void]

# File lib/pepito/handlers/info.rb, line 21
def web(_request, response)
  response.headers['Content-Type'] = 'application/json'
  json = MultiJson.dump(
    pepito_version: Pepito::VERSION
  )
  response.write(json)
end