From b9d4fd7da8f14f51b4dcc7d7670ee8b1b0bce76a Mon Sep 17 00:00:00 2001 From: ItsOnlyBinary Date: Wed, 28 Aug 2024 15:41:47 +0100 Subject: [PATCH] Update docs --- docs/events.md | 11 +++++++---- src/commands/handlers/user.js | 10 ++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/events.md b/docs/events.md index 85f9c41..ebc4bbc 100644 --- a/docs/events.md +++ b/docs/events.md @@ -596,11 +596,13 @@ Not all of these options will be available. Some will be missing depending on th **whowas** -The response includes the latest known data. -If more than one RPL_WHOWASUSER is returned by the server, older ones -are stored in the same format in the 'historical' array from newest to oldest. +The response root includes the latest data `historical[0]` to maintain backwards compatibility. +The `historical` array contains all RPL_WHOWASUSER responses with the newest being first. + +If the requested user was not found, `error` will contain 'no_such_nick'. + +> Note: The available data can vary depending on the network. -If the requested user was not found, error will contain 'no_such_nick'. ~~~javascript { nick: 'prawnsalad', @@ -608,6 +610,7 @@ If the requested user was not found, error will contain 'no_such_nick'. hostname: 'manchester.isp.net', actual_ip: 'sometimes set when using webirc, could be the same as actual_hostname', actual_hostname: 'sometimes set when using webirc', + actual_username: 'prawn', real_name: 'A real prawn', server: 'irc.server.net', server_info: 'Thu Jun 14 09:15:51 2018', diff --git a/src/commands/handlers/user.js b/src/commands/handlers/user.js index 6ded591..1469d59 100644 --- a/src/commands/handlers/user.js +++ b/src/commands/handlers/user.js @@ -362,8 +362,8 @@ const handlers = { const host = user_host.substring(mask_sep + 1); if (host) { - cache.actual_user = user; - cache.actual_host = host; + cache.actual_username = user; + cache.actual_username = host; } }, @@ -392,12 +392,6 @@ const handlers = { const event = _.cloneDeep(whowas_cache.historical[0]); event.historical = whowas_cache.historical; - // Should, in theory, never happen. - if (!event.nick) { - event.nick = command.params[1]; - event.error = 'no_such_nick'; - } - handler.emit('whowas', event); whois_cache.destroy(); whowas_cache.destroy();