npm.io
3.2.8 • Published 5d ago

@vinzsocket/baileys

Licence
MIT
Version
3.2.8
Deps
11
Size
8.1 MB
Vulns
0
Weekly
3.0K
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

Harps Baileys

A lightweight WebSocket library for WhatsApp Web Multi-Device

GitHub Version Node.js


Install

npm install @vinzsocket/baileys

Changelog v3.2.8

Group Status V4 — Semua Media + Caption

handleGroupStory sekarang support semua tipe media dengan caption:

Tipe Field Caption
Teks text
Foto image caption
Video video caption
Audio voice note audio + ptt: true
Audio musik audio + ptt: false
Sticker sticker
Dokumen document caption
Multi-Select Message

Satu pesan dengan beberapa tombol dropdown (single_select) sekaligus. Tiap tombol buka bottom sheet sendiri dengan sections & rows berbeda.

Nested List Message

Legacy listMessage dengan auto-flatten nested rows jadi sections terpisah.

NF V7 Button Builders

Export semua 12 native flow button builder dari dugong.js.

buildInteractiveAdditionalNodes

Tambah handler groupStatusMessageV2 — inject <meta is_vsn2="1"> di grup.


Group Status V2

Teks
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        text: '📢 Pengumuman penting dari admin!'
    }
})
Teks dengan Background Color
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        text: 'Status dengan background merah',
        backgroundColor: 0xFFE53935,  // ARGB
        textArgb: 0xFFFFFFFF,
        font: 1  // 0-5
    }
})
Foto dengan Caption
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        image: { url: 'https://example.com/photo.jpg' },
        caption: '📸 Foto kegiatan hari ini!'
    }
})

// Atau pakai Buffer
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        image: fs.readFileSync('./photo.jpg'),
        caption: 'Caption foto'
    }
})
Video dengan Caption
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        video: { url: 'https://example.com/video.mp4' },
        caption: '🎬 Video kegiatan',
        seconds: 30  // opsional, durasi
    }
})
GIF
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        video: { url: 'https://example.com/anim.mp4' },
        gifPlayback: true
    }
})
Audio Voice Note
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        audio: { url: 'https://example.com/voice.ogg' },
        ptt: true,   // voice note
        seconds: 15  // durasi opsional
    }
})
Audio Musik
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        audio: { url: 'https://example.com/music.mp3' },
        ptt: false,             // bukan voice note
        mimetype: 'audio/mp4'  // atau 'audio/mpeg'
    }
})
Sticker
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        sticker: { url: 'https://example.com/sticker.webp' }
    }
})
Dokumen dengan Caption
await conn.sendMessage(groupJid, {
    groupStatusMessage: {
        document: { url: 'https://example.com/file.pdf' },
        mimetype: 'application/pdf',
        fileName: 'Laporan.pdf',
        caption: '📄 Laporan bulan ini'
    }
})

Multi-Select Message

Satu pesan, beberapa tombol dropdown. Tiap tombol buka bottom sheet sendiri.

await conn.sendMessage(jid, {
    multiSelectMessage: {
        title: '⚙️ Konfigurasi Karakter',
        footer: 'Pilih semua opsi',
        selectors: [
            {
                displayText: '⚔️ Pilih Senjata',
                sections: [
                    {
                        title: '🗡️ Melee',
                        rows: [
                            { id: 'sword', title: '⚔️ Iron Sword', description: '40 ATK' },
                            { id: 'axe',   title: '🪓 Battle Axe', description: '60 ATK' }
                        ]
                    },
                    {
                        title: '🏹 Ranged',
                        rows: [
                            { id: 'bow',  title: '🏹 Busur',    description: '30 ATK' },
                            { id: 'xbow', title: '🔫 Crossbow', description: '55 ATK' }
                        ]
                    }
                ]
            },
            {
                displayText: '🛡️ Pilih Armor',
                sections: [
                    {
                        title: '🧥 Light',
                        rows: [
                            { id: 'cloth',   title: '👕 Cloth',   description: '10 DEF' },
                            { id: 'leather', title: '🥼 Leather', description: '25 DEF' }
                        ]
                    }
                ]
            }
        ],
        // Tombol tambahan opsional
        extraButtons: [
            { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: '✅ Konfirmasi', id: 'confirm' }) }
        ]
    }
}, { quoted: msg })

Nested List Message

Legacy listMessage dengan nested sections otomatis.

await conn.sendMessage(jid, {
    nestedListMessage: {
        title: '🛒 Harps Shop',
        buttonText: '📋 Buka Katalog',
        footer: 'Pilih item',
        sections: [
            {
                title: '⚔️ Senjata',
                rows: [
                    // Flat row biasa
                    { rowId: 'dagger', title: '🗡️ Dagger', description: '25 ATK' },
                    // Nested row → otomatis jadi section baru "🏹 Jarak Jauh"
                    {
                        title: '🏹 Jarak Jauh',
                        rows: [
                            { rowId: 'bow',  title: '🏹 Busur',    description: '30 ATK' },
                            { rowId: 'xbow', title: '🔫 Crossbow', description: '55 ATK' }
                        ]
                    }
                ]
            }
        ]
    }
}, { quoted: msg })

NF V7 Button Builders

import {
    nfButtonUrl, nfButtonCall, nfButtonCopy,
    nfButtonReminder, nfButtonCancelReminder,
    nfButtonAddress, nfButtonLocation,
    nfButtonQuickReply, nfButtonSingleSelect,
    nfButtonMultiSelect,
    nfButtonReviewPay, nfButtonReviewOrder, nfButtonMPM
} from '@vinzsocket/baileys/lib/Socket/dugong.js'

await conn.sendMessage(jid, {
    interactiveMessage: {
        title: '🎛️ Mixed Buttons',
        footer: 'Harps-MD',
        buttons: [
            nfButtonQuickReply({ id: 'ok',    displayText: '✅ OK' }),
            nfButtonUrl({        displayText: '🌐 Website', url: 'https://example.com' }),
            nfButtonCopy({       displayText: '📋 Salin',   copyCode: 'KODE123' }),
            nfButtonSingleSelect({
                displayText: '📋 Pilih',
                sections: [
                    { title: 'Opsi', rows: [
                        { id: 'a', title: 'Opsi A' },
                        { id: 'b', title: 'Opsi B' }
                    ]}
                ]
            })
        ]
    }
}, { quoted: msg })
Builder Nama Proto Fungsi
nfButtonUrl cta_url Buka URL
nfButtonCall cta_call Telepon
nfButtonCopy cta_copy Salin kode
nfButtonReminder cta_reminder Set reminder
nfButtonCancelReminder cta_cancel_reminder Batalkan reminder
nfButtonAddress address_message Isi & kirim alamat
nfButtonLocation send_location Kirim GPS
nfButtonQuickReply quick_reply Balas cepat
nfButtonSingleSelect single_select 1 dropdown
nfButtonMultiSelect single_select ×N Beberapa dropdown
nfButtonReviewPay review_and_pay Payment flow
nfButtonReviewOrder review_order Review order
nfButtonMPM mpm Multi-product

additionalNodes

Semua interactive/list message butuh binary node hint. Harps-Baileys inject otomatis — tidak perlu relay manual.

Kalau perlu relay manual:

import { buildInteractiveAdditionalNodes } from '@vinzsocket/baileys/lib/Utils/messages.js'

await relayMessage(jid, msg.message, {
    messageId: msg.key.id,
    additionalNodes: buildInteractiveAdditionalNodes(jid, msg.message)
})

License

MIT — Alvin-B2T

Keywords