mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Update 7.MessagesExtra.ts
This commit is contained in:
@@ -197,7 +197,7 @@ export class WAConnection extends Base {
|
|||||||
/**
|
/**
|
||||||
* Loads all messages sent after a specific date
|
* Loads all messages sent after a specific date
|
||||||
*/
|
*/
|
||||||
async messagesReceivedAfter (date: Date) {
|
async messagesReceivedAfter (date: Date, onlyUnrespondedMessages = false) {
|
||||||
const stamp = unixTimestampSeconds (date)
|
const stamp = unixTimestampSeconds (date)
|
||||||
// find the index where the chat timestamp becomes greater
|
// find the index where the chat timestamp becomes greater
|
||||||
const idx = this.chats.all ().findIndex (c => c.t < stamp)
|
const idx = this.chats.all ().findIndex (c => c.t < stamp)
|
||||||
@@ -208,7 +208,7 @@ export class WAConnection extends Base {
|
|||||||
await Promise.all (
|
await Promise.all (
|
||||||
chats.map (async chat => {
|
chats.map (async chat => {
|
||||||
await this.findMessage (chat.jid, 5, m => {
|
await this.findMessage (chat.jid, 5, m => {
|
||||||
if (toNumber(m.messageTimestamp) < stamp) return true
|
if (toNumber(m.messageTimestamp) < stamp || (onlyUnrespondedMessages && m.key.fromMe)) return true
|
||||||
messages.push (m)
|
messages.push (m)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user