Module: ESM::Command::Server::Logs::V1
- Defined in:
- lib/esm/command/server/logs.rb
Instance Method Summary collapse
- #on_execute ⇒ Object
-
#on_response ⇒ Object
Response: 0: The search parameters 1..-1: The parsed logs date:
October 11 2020 file_name (Exile_TradingLog.log): line: entry: date: <String 2020-10-11>.
Instance Method Details
#on_execute ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/esm/command/server/logs.rb', line 123 def on_execute query = "" # If the target was given, check to make sure they're registered and then set the steam_uid if target_user check_for_registered_target_user! if target_user.is_a?(ESM::User) query = target_user.steam_uid else # Escape any regex in the "query" query = Regexp.quote(arguments.target) end deliver!(search: query, length: 14) end |
#on_response ⇒ Object
Response:
0: The search parameters
1..-1: The parsed logs
date:
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/esm/command/server/logs.rb', line 147 def on_response check_for_no_logs! @log = ESM::Log.create!(server_id: target_server.id, search_text: arguments.target, requestors_user_id: current_user.id) parse_logs = ESM::Embed.build do |e| e.title = "Log parsing for `#{target_server.server_id}` completed" e.description = "You may review the results here:\n#{@log.link}\n\n_Link expires on `#{@log.expires_at.strftime(ESM::Time::Format::TIME)}`_" end reply() end |