npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

baileys-rekber

v1.0.0

Published

Modifikasi @whiskeysockets/baileys untuk bot rekber (escrow) WhatsApp dengan LID Converter otomatis. Mendukung konversi LID dari sumber manapun.

Downloads

124

Readme

🏦 baileys-rekber

Modifikasi @whiskeysockets/baileys untuk bot rekening bersama (rekber/escrow) WhatsApp dengan LID Converter otomatis.


✨ Fitur Utama

| Fitur | Keterangan | |---|---| | 🔗 LID Converter | Konversi LID ↔ JID ↔ Phone dari sumber manapun secara otomatis | | 🏦 Rekber Engine | Sistem escrow lengkap dengan status PENDING → DONE | | 💾 Persistent Storage | Data transaksi & LID mapping tersimpan di file JSON | | 🤖 Bot Commands | Command !rekber, !bayar, !terima, dll siap pakai | | 🔄 Auto-patch | LID otomatis diisi dari semua event Baileys | | 🧪 Unit Tested | 45 test semua lulus |


📦 Instalasi

# Clone atau copy folder ini
npm install

Atau jika dipublish ke npm:

npm install baileys-rekber

🚀 Quick Start

const { createRekberBot } = require('baileys-rekber')

;(async () => {
    const { sock } = await createRekberBot({
        sessionDir:  './auth_info',
        dataDir:     './rekber-data',
        adminPhone:  '628123456789',   // nomor admin/mediator
        prefix:      '!',
        feePercent:  0,               // fee 0% = gratis
    })

    sock.ev.on('connection.update', ({ connection }) => {
        if (connection === 'open') console.log('Bot online!')
    })
})()

Jalankan:

node example/bot.js
# atau
npm start

🔗 LID Converter

LID (Linked Device ID) adalah ID baru WhatsApp yang dipakai untuk privasi nomor telepon. Package ini mengkonversi LID secara otomatis dari:

  • Event kontak (contacts.upsert, contacts.update)
  • Pesan masuk (messages.upsert, key.participant, key.participantLid)
  • Update grup (group-participants.update)
  • Manual (register, registerBatch, registerFromContact)

Cara Pakai LidConverter

const { LidConverter } = require('baileys-rekber')

const conv = new LidConverter()

// ── Normalisasi input apapun ──────────────────────────────
LidConverter.normalize('081234567890')        // → [email protected]
LidConverter.normalize('lid:123456789')       // → 123456789:0@lid
LidConverter.normalize('[email protected]')         // → [email protected]

// ── Register mapping ──────────────────────────────────────
conv.register('111111:0@lid', '[email protected]')
conv.registerFromContact({ id: '[email protected]', lid: '222:0@lid', name: 'Budi' })
conv.registerBatch(contacts)   // array kontak dari Baileys

// ── Konversi ──────────────────────────────────────────────
conv.lidToJid('111111:0@lid')           // → [email protected]
conv.jidToLid('[email protected]') // → 111111:0@lid
conv.lidToPhone('111111:0@lid')          // → 6281111111111
conv.phoneToLid('6281111111111')         // → 111111:0@lid

// ── Resolve dari input APAPUN ─────────────────────────────
conv.resolveToJid('081111111111')        // → [email protected]
conv.resolveToJid('111111:0@lid')        // → [email protected]
conv.resolveToJid('[email protected]') // → [email protected]

conv.resolveAll('111111:0@lid')
// → { jid, lid, phone, name, isResolved }

Patch Manual ke Socket Baileys

const { makeWASocket, patchBaileysSock } = require('baileys-rekber')

const sock = makeWASocket({ ... })
patchBaileysSock(sock, { debug: true })

// Setelah patch, socket punya method tambahan:
sock.resolveJid('081234567890')    // → JID
sock.resolveSender(msg)            // → JID sender (support LID participant)
sock.resolveAll('lid:12345')       // → { jid, lid, phone, name }
sock.lidConverter                  // → instance LidConverter

🏦 Sistem Rekber

Flow Status Transaksi

PENDING → AGREED → PAID → CONFIRMED → DONE
   ↓                            ↓
CANCELLED                  DISPUTED → REFUNDED

Command Bot (prefix !)

| Command | Keterangan | |---|---| | !rekber @seller 500000 Beli item | Buat transaksi rekber baru | | !rekber 628xxx 500000 Beli item | Dengan nomor telepon | | !rekber lid:12345 500000 Beli item | Dengan LID | | !setuju RKB-XXXXX | Setujui transaksi | | !bayar RKB-XXXXX bukti-transfer | Konfirmasi pembayaran | | !terima RKB-XXXXX | Konfirmasi barang diterima | | !selesai RKB-XXXXX | Finalisasi (dana dilepas) | | !sengketa RKB-XXXXX alasan | Buka sengketa | | !batal RKB-XXXXX alasan | Batalkan transaksi | | !cektx RKB-XXXXX | Lihat info transaksi | | !txsaya | Daftar transaksi aktif saya | | !ceklid lid:12345 | Resolve LID/JID/nomor | | !help | Tampilkan bantuan |

Contoh Output Bot

╔══ 🏦 REKBER ══╗
║ ID: `RKB-M5X1A2BC-0001`
║ Status: 💸 PAID
╠═══════════════╣
║ 👤 Buyer  : @628111xxxxxx
║ 🏪 Seller : @628222xxxxxx
╠═══════════════╣
║ 📦 Item   : Akun Mobile Legends
║ 💰 Nominal: Rp 500.000
╠═══════════════╣
║ 🤝 Buyer setuju : ✅
║ 🤝 Seller setuju: ✅
║ 🧾 Bukti: ref-BCA-12345
╚══════════════════╝

💻 RekberManager (Programmatic)

const { RekberManager, LidConverter } = require('baileys-rekber')

const conv = new LidConverter()
const mgr  = new RekberManager(conv, {
    feePercent: 1,      // 1% fee
    feeFixed:   2500,   // + Rp 2.500
    adminJid:   '[email protected]',
})

// Buat transaksi - bisa pakai LID, JID, atau nomor telepon
const tx = mgr.create({
    buyer:  'lid:111111',              // LID
    seller: '[email protected]', // JID
    amount: 500000,
    desc:   'Akun Mobile Legends',
})

// Event listener
mgr.on('created',   tx => console.log('Dibuat:', tx.id))
mgr.on('paid',      tx => console.log('Bayar masuk:', tx.id))
mgr.on('completed', tx => console.log('Selesai:', tx.id))

// Flow transaksi
mgr.agree(tx.id, buyerJid)
mgr.agree(tx.id, sellerJid)
mgr.confirmPayment(tx.id, buyerJid, 'bukti-transfer')
mgr.confirmReceived(tx.id, buyerJid)
mgr.complete(tx.id, buyerJid)

// Format output
console.log(mgr.formatTx(tx.id))

💾 Storage (Persistent)

const { RekberStorage } = require('baileys-rekber')

const storage = new RekberStorage('./rekber-data')

// Attach ke manager (auto save + restore)
storage.attachToManager(rekberBot.rekber)

// Manual backup
storage.backup()

// Hapus TX lama > 30 hari
storage.cleanup(30)

// Statistik
console.log(storage.getStats())
// { totalTransactions: 42, lidMappings: 150, dataDir: '/path/...' }

🧪 Menjalankan Test

npm test
# atau
node test/test.js
Hasil: 45 passed, 0 failed
🎉 Semua test berhasil!

📁 Struktur File

baileys-rekber/
├── index.js                    ← Entry point & factory
├── package.json
├── src/
│   ├── lid/
│   │   └── LidConverter.js     ← Konverter LID utama
│   ├── patches/
│   │   └── patchBaileysSock.js ← Inject ke Baileys socket
│   ├── rekber/
│   │   ├── RekberManager.js    ← Engine transaksi rekber
│   │   └── RekberBot.js        ← Handler command WhatsApp
│   └── utils/
│       ├── helpers.js          ← Utility functions
│       └── RekberStorage.js    ← Persistent storage
├── example/
│   └── bot.js                  ← Contoh bot siap pakai
└── test/
    └── test.js                 ← Unit tests (45 test)

📝 Lisensi

MIT — bebas digunakan dan dimodifikasi.