Skip to content

Commit

Permalink
Always create the whowas array; Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsOnlyBinary committed Aug 29, 2024
1 parent 51a97ca commit 25f25f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ Not all of these options will be available. Some will be missing depending on th

**whowas**

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.
The response root includes the latest data from `whowas[0]` to maintain backwards compatibility.
The `whowas` array contains all RPL_WHOWASUSER responses with the newest being first.

If the requested user was not found, `error` will contain 'no_such_nick'.

Expand All @@ -616,7 +616,7 @@ If the requested user was not found, `error` will contain 'no_such_nick'.
server_info: 'Thu Jun 14 09:15:51 2018',
account: 'logged on account',
error: ''
historical: [
whowas: [
{ ... },
{ ... },
]
Expand Down
2 changes: 1 addition & 1 deletion src/commands/handlers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ const handlers = {

// after all prior RPL_WHOWASUSER pushed newer events onto the history stack
// push the last one to complete the set (server returns from newest to oldest)
whowas_cache.whowas = whowas_cache.whowas || [];
if (!whois_cache.error) {
whowas_cache.whowas = whowas_cache.whowas || [];
whowas_cache.whowas.push(_.cloneDeep(whois_cache));
Object.assign(whowas_cache, _.cloneDeep(whowas_cache.whowas[0]));
} else {
Expand Down

0 comments on commit 25f25f5

Please sign in to comment.