[core] WEBJS - optimize media

This commit is contained in:
devlikepro committed 2024-08-27 16:43:26 +07:00
1 parent abae3f14cd
commit fee75d0c8a
1 file changed
+5 -5
+5 -5
View File
@@ -468,12 +468,12 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
const messages = await chat.fetchMessages({
limit: limit,
});
// Go over messages, download media, and convert to right format.
const result = [];
for (const message of messages) {
const msg = await this.processIncomingMessage(message, downloadMedia);
result.push(msg);
const promises = [];
for (const msg of messages) {
promises.push(this.processIncomingMessage(msg, downloadMedia));
}
let result = await Promise.all(promises);
result = result.filter(Boolean);
return result;
}