class Lita::Handlers::Users

Provides information on Lita users. @since 4.1.0

Public Instance Methods

find(response) click to toggle source

Outputs the name, ID, and mention name of a user matching the search query. @param response [Lita::Response] The response object. @return [void]

# File lib/lita/handlers/users.rb, line 15
def find(response)
  user = Lita::User.fuzzy_find(response.args[1])

  if user
    response.reply(formatted_user(user))
  else
    response.reply(t("find_empty_state"))
  end
end

Private Instance Methods

formatted_user(user) click to toggle source

Extract and label the relevant user information.

# File lib/lita/handlers/users.rb, line 28
def formatted_user(user)
  "#{user.name} (ID: #{user.id}, Mention name: #{user.mention_name})"
end