Skip to content

This code is to replace the store ( makeInMemoryStore ) which has been removed in the latest Baileys.

Notifications You must be signed in to change notification settings

dcodemaxz/makeInMemoryStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

📂 makeInMemoryStore

makeInMemoryStore is a JavaScript module that provides a highly efficient in-memory data storage solution. It serves as a direct substitute for data storage mechanisms that may have been removed or modified within the Baileys library, which is crucial for WhatsApp bot operations. By implementing makeInMemoryStore, your bot script can manage and access session data directly in system memory, ensuring optimal responsiveness and data processing speed. This module is highly recommended for scenarios requiring:

  • Development and Testing: Fast iteration without worrying about data persistence to disk.
  • Temporary Use Case: When data persistence to disk is not required, for example for bots that do not keep long histories.

⚙️ Core Functionality

makeInMemoryStore functions as a temporary data store that operates entirely in memory. This means that all stored data will be lost after the application process ends. Make sure you understand these implications before using it in a production environment that requires data persistence.


📥 Installation

To take advantage of the recommended logging features, make sure you have the pino module installed:

npm install pino

To use makeInMemoryStore, you need to import and initialize it. You can integrate it with a logging system like pino to monitor storage activity.

Here is an example implementation for your index.js file:

// Make sure the path to 'store.js' is correct
const makeInMemoryStore = require('./store.js'); 
const pino = require('pino'); // Import pino for logging

// Initialize the main logger
const logger = pino({
    level: 'silent' // Set the logging level as needed (e.g., 'info', 'debug')
});

// Create an in-memory storage instance
const store = makeInMemoryStore({
    logger: logger.child({
        stream: 'store' // Dedicated stream for storage related logs
    })
});

// Now the 'store' object is ready to manage your in-memory data!
// Example: store.groupMetadata(), store.messages(), store.contacts(), ~.

🤝 Contribution

We welcome contributions in the form of bug reports, feature requests, or pull requests. Please submit them through the project's GitHub repository.

©️ License

This script is originally made by dcodemaxz ( me )

About

This code is to replace the store ( makeInMemoryStore ) which has been removed in the latest Baileys.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published