Problem when fetch Messages with searchOptions as undefined or with high limit #1471
Closed
1 task done
Labels
enhancement
New feature or request
Is there an existing issue for this?
Is your feature request related to a problem? Please describe.
Yes. The problem is if I call the method
fetchMessages
withsearchOptions
asundefined
, in some chats, it will not return the messages. But, if I put the limit with low numbers, it will get the messages. On high numbers, it will stay in a loop.Describe the solution you'd like.
I fixed by checking if the
searchOption
areundefined
, iftrue
it will defined thelimit
as 30. I also put|| loadedMessages.length == 0
, inside the if onwhile
:`
async fetchMessages(searchOptions) {
let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => {
const msgFilter = m => !m.isNotification; // dont include notification messages
`
But a better solution is a fix to get messages even if the
searchOptions
isundefined
.Describe an alternate solution.
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: