From 64803c2ba61bf4c5d97503b99a9c2d1f44d41639 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 6 Feb 2022 19:30:13 -0400 Subject: [PATCH] update typings for `fetchMessages` changes --- index.d.ts | 3 +-- src/structures/Chat.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 42b32bd..65b6ea9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -930,10 +930,9 @@ declare namespace WAWebJS { export interface MessageSearchOptions { /** - * The amount of messages to return. + * The amount of messages to return. If no limit is specified, the available messages will be returned. * Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. * Set this to Infinity to load all messages. - * @default 50 */ limit?: number } diff --git a/src/structures/Chat.js b/src/structures/Chat.js index e4f59d1..01eec83 100644 --- a/src/structures/Chat.js +++ b/src/structures/Chat.js @@ -181,7 +181,7 @@ class Chat extends Base { const chat = window.Store.Chat.get(chatId); let msgs = chat.msgs.models.filter(msgFilter); - if (searchOptions && searchOptions.limit) { + if (searchOptions && searchOptions.limit > 0) { while (msgs.length < searchOptions.limit) { const loadedMessages = await chat.loadEarlierMsgs(); if (!loadedMessages) break;