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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@merajah/baileys

v4.4.0

Published

Baileys wrapper with event system, serialize, and anti-delete support

Readme

📦 @merajah/baileys

High-level WhatsApp Web API wrapper berbasis Baileys Engine yang dirancang untuk efisiensi. Library ini menyediakan fitur otomatisasi media, serialisasi pesan yang ringkas (SMSG), dan berbagai helper tambahan untuk mempermudah pengembangan bot WhatsApp.

Fitur Utama

  • Enhanced Socket (extra.js): Fungsi tambahan seperti sendFile, reply, dan downloadM disuntikkan langsung ke instance socket.
  • Simplified Message (serialize.js): Mengubah struktur pesan Baileys yang kompleks menjadi format yang lebih mudah digunakan (m.body, m.sender, dll).
  • Auto Media Converter: Integrasi FFmpeg untuk konversi otomatis Voice Note (Opus) dan Video (MP4).
  • Pairing Code: Mendukung autentikasi tanpa scan QR.
  • Persistent Cache: Penyimpanan metadata grup dan kontak secara lokal agar performa lebih cepat.

INSTALLING

npm install @merajah/baileys

npm start

Catatan: Pastikan FFmpeg terinstal di sistem Anda untuk fitur konversi media.

Penggunaan & Dokumentasi API

const Baileys = require('@merajah/baileys');

const bot = new Baileys({
    session: 'session_data', // Nama folder session
    number: '628xxxxxxxx',   // Isi nomor untuk login via Pairing Code
    online: true,             // Set status bot selalu online
    plugins: 'plugins'        // set plugins dirname
});

bot.register('ready', ({ sock }) => {
    console.log('✅ Bot Berhasil Terhubung!');
});

bot.register('message', async ({ sock, m, command, text, args }) => {
    
    // 1. Membalas pesan dengan m.reply (Simple)
    if (command === 'ping') {
        await m.reply('Pong!');
    }

    // 2. Mengirim file menggunakan sock.sendFile (Extra.js)
    // Otomatis deteksi Buffer, URL, atau Path Lokal
    if (command === 'sendimg') {
        await sock.sendFile(m.chat, 'https://example.com/image.jpg', 'foto.jpg', 'Ini caption', m);
    }

    // 3. Mengirim Voice Note (PTT) - Otomatis konversi ke format WhatsApp
    if (command === 'vn') {
        await sock.sendFile(m.chat, './audio.mp3', '', '', m, { ptt: true });
    }

    // 4. Mengirim Video sebagai GIF
    if (command === 'gif') {
        await sock.sendFile(m.chat, './video.mp4', '', 'Ini GIF', m, { gif: true });
    }

    // 5. Download Media (Extra.js)
    if (command === 'download' && m.quoted) {
        // Download media dari pesan yang dibalas
        const buffer = await sock.downloadM(m.quoted.msg, m.quoted.mtype.replace('Message', ''));
        await sock.sendFile(m.chat, buffer, 'file.jpg', 'Hasil download');
    }
});
// EVENT: MANAJEMEN GRUP
bot.register('group.add', ({ jid, participants }) => {
    // Member baru bergabung
});

bot.register('group.remove', ({ jid, participants }) => {
    // Member keluar/dikick
});

bot.register('group.promote', ({ jid, participants }) => {
    // Member naik jabatan jadi admin
});

// EVENT: LAINNYA
bot.register('message.delete', ({ m }) => {
    // Anti-delete: dipanggil saat pesan dihapus
});

bot.register('error', ({ error }) => {
    // Penanganan error sistem
});

Message

| Properti | Deskripsi | |---|---| | m.id | ID unik dari pesan. | | m.chat | JID percakapan (Grup atau Private Chat). | | m.sender | JID pengirim yang sudah diformat (bersih). | | m.fromMe | Boolean, true jika pesan dikirim oleh bot sendiri. | | m.isGroup | Boolean, true jika pesan berasal dari grup. | | m.mtype | Tipe pesan (contoh: conversation, imageMessage). | | m.body | Isi teks pesan (mendukung pesan teks biasa, caption media, atau tombol). | | m.quoted | Objek pesan yang dibalas (jika ada), berisi properti yang sama seperti m. | | m.mentionedJid | Daftar JID yang di-mention dalam pesan. | | m.reply(text) | Fungsi cepat untuk membalas pesan tersebut. | | m.download() | Fungsi cepat untuk mengunduh media yang ada pada pesan. |

Options Baileys

const bot = new Baileys({
    session: 'auth_folder',
    number: '628xxx',
    online: true
}, {
    // Opsi asli dari Baileys SocketConfig (WASocketConfig)
    printQRInTerminal: true,
    browser: ['Merajah', 'Chrome', '1.0.0'],
    syncFullHistory: false
});

Merajah Team

  • Dwi-Merajah (Developer) Thanks For Installing My Wrapper Module