Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

📦 Baileys In-Memory Store

Single File • No TS • Fast • Simple • Baileys Ready


📖 Description

Lightweight in-memory store for Baileys WhatsApp Library is memory based. No TypeScript, no additional dependencies, just one package to use.

✨ Features

  • 📂 Chats, Messages, Contacts, Groups
  • 🧠 In-memory store (fast & light)
  • 🔄 Auto sync via ev Baileys
  • 💾 Save & Load JSON/SQLITE/BROTLI
  • 🏷️ Label & Label Association
  • 🔖 Label Member
  • 🟢 Presence tracking

🧩 Function

  • bind(ev) – bind event Baileys
  • loadMessages(jid, count, cursor?)
  • loadMessage(jid, id)
  • mostRecentMessage(jid)
  • fetchImageUrl(jid, sock?)
  • fetchGroupMetadata(jid, sock?)
  • getLabels()
  • getChatLabels(chatId)
  • getMessageLabels(messageId)
  • getGroupLabelMember(chat, jid)
  • getGroupLabelMembers(chat)
  • writeToFile(path)
  • readFromFile(path)
  • writeToFileSqlite(path)
  • readFromFileSqlite(path)
  • writeToFileBrotli(path)
  • readFromFileBrotli(path)
  • writeToFileAuto(path)
  • readFromFileAuto(path)

🚀 How to Use



import InMemoryStore from "baileys-inmemory-store"
import baileys from "baileys"

const sock = baileys.makeWASocket({
  // config
})

const store = new InMemoryStore()
store.bind(sock.ev)

// take the last message
const msg = store.mostRecentMessage(jid)

// take the last 20 messages
store.loadMessages(jid, 20)

// load messages before a specific message
const before = store.loadMessages(jid, 20, {
  before: {
    id: messageId
  }
});

// load messages after a specific message
const after = store.loadMessages(jid, 20, {
  afterr: {
    id: messageId
  }
});

// load messages before a specific message
// `id` defaults to before
const messagesBefore = store.loadMessages(jid, 20, {
  id: messageId
});

/*
  { afterr: { id: '123' } } // after
  { after:  { id: '123' } } // after
  { afterr: '123' }         // after
  { after:  '123' }         // after
  { before: { id: '123' } } // before
  { before: '123' } // before
  { id: '123' }             // before/default
*/

// load 1 message
const msg = store.loadMessage(jid, messageId);

// take the most recent message
const recent = store.mostRecentMessage(jid);

💾 Save / Load ( JSON )


store.writeToFile("./store.json")
store.readFromFile("./store.json")

💾 Save / Load ( Sqlite )


store.writeToFileSqlite("./store.db") //Promise
store.readFromFileSqlite("./store.db") //Promise

💾 Save / Load ( BROTLI )


store.writeToFileBrotli("./store.br") //Promise
store.readFromFileBrotli("./store.br") //Promise

💾 Save / Load ( AUTO )


store.writeToFileAuto("./store.json") //Promise
// Or
store.writeToFileAuto("./store.db") //Promise
// Or
store.writeToFileAuto("./store.br") //Promise

store.readFromFileAuto("./store.json") //Promise
// Or
store.readFromFileAuto("./store.db") //Promise
// Or
store.readFromFileAuto("./store.br") //Promise

👤 Credit

FgsiDev
Built for Baileys WhatsApp ecosystem


⚡ Simple • Brutal • Works

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages