mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: make use of "msgRetryCounterMap" more explicit
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, makeInMemoryStore, useSingleFileAuthState } from '../src'
|
||||
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, makeInMemoryStore, MessageRetryMap, useSingleFileAuthState } from '../src'
|
||||
import MAIN_LOGGER from '../src/Utils/logger'
|
||||
|
||||
const logger = MAIN_LOGGER.child({ })
|
||||
@@ -8,6 +8,10 @@ logger.level = 'trace'
|
||||
const useStore = !process.argv.includes('--no-store')
|
||||
const doReplies = !process.argv.includes('--no-reply')
|
||||
|
||||
// external map to store retry counts of messages when decryption/encryption fails
|
||||
// keep this out of the socket itself, so as to prevent a message decryption/encryption loop across socket restarts
|
||||
const msgRetryCounterMap: MessageRetryMap = { }
|
||||
|
||||
// the store maintains the data of the WA connection in memory
|
||||
// can be written out to a file & read from it
|
||||
const store = useStore ? makeInMemoryStore({ logger }) : undefined
|
||||
@@ -30,6 +34,7 @@ const startSock = async() => {
|
||||
logger,
|
||||
printQRInTerminal: true,
|
||||
auth: state,
|
||||
msgRetryCounterMap,
|
||||
// implement to handle retries
|
||||
getMessage: async key => {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user