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

@otaxayun/baileys

v6.7.33

Published

WhatsApp API Modification

Downloads

6,287

Readme

⸙ 𝙊𝙏𝘼𝙓 — 𝙎𝙔𝙎𝙏𝙀𝙈.𝘽𝘼𝙄𝙇𝙀𝙔𝙎

⸙ Deskripsi

sistem.baileys adalah modul inti OTAX yang menangani seluruh proses koneksi WhatsApp. Modul ini mengelola lifecycle WebSocket Baileys, validasi sesi, pairing, sinkronisasi event, media handler, hingga mekanisme auto-recovery. Sistem ini didesain untuk performa tinggi, reconnect cepat, dan stabilitas maksimal dalam ekosistem OTAX.


⸙ Fitur Utama

⚙️ Inisialisasi WebSocket Baileys dengan konfigurasi OTAX

🔁 Auto-reconnect dan pemulihan state ketika koneksi terputus

🧩 Integrasi penuh ke modul OTAX lain: SessionPool, SenderLock, Gateway, EventRouter

📡 Event lengkap: messages.upsert, connection.update, contacts.update, groups.update

🔒 Proteksi runtime: anti-crash, anti-tamper, auto-heal, markOnlineOnConnect control

📦 Store terintegrasi: in-memory, FS, dan adapter eksternal

🖼️ Media utility: unduh, reupload, convert, decrypt, stream

📲 Pairing mode ganda: QR dan pairing code


⸙ Alur Kerja sistem.baileys

  1. Memuat kredensial dari OTAX_SESSION_DIR

  2. Membuka koneksi WebSocket WhatsApp

  3. Melakukan sinkronisasi perangkat

  4. Mengaktifkan event handler inti

  5. Menghubungkan store untuk riwayat dan retry

  6. Menjalankan sistem proteksi runtime

  7. Mengaktifkan server event internal untuk modul lain

  8. Jika koneksi terputus, sistem menjalankan auto-recovery


⸙ Konfigurasi Sistem

Gunakan environment variable berikut:

OTAX_SESSION_DIR=./data/auth/otax OTAX_LOG_DIR=./logs OTAX_SENDER_NUMBER=6285XXXXXXXX OTAX_RUNTIME_MODE=production OTAX_USE_STORE=true

Struktur direktori yang direkomendasikan:

. ├─ system/ │ └─ baileys/ │ ├─ index.ts │ ├─ core.ts │ ├─ connect.ts │ ├─ events.ts │ └─ media.ts ├─ data/ │ └─ auth/ ├─ logs/ └─ package.json


⸙ Inisialisasi Socket

TypeScript:

import makeWASocket, { useMultiFileAuthState, Browsers, DisconnectReason } from "@whiskeysockets/baileys" import pino from "pino"

export async function initBaileys() { const { state, saveCreds } = await useMultiFileAuthState(process.env.OTAX_SESSION_DIR) const sock = makeWASocket({ auth: state, browser: Browsers.macOS("OTAX-System"), markOnlineOnConnect: false, printQRInTerminal: true, logger: pino({ level: "silent" }) })

sock.ev.on("creds.update", saveCreds)

sock.ev.on("connection.update", ({ connection, lastDisconnect }) => { const code = lastDisconnect?.error?.output?.statusCode if (connection === "close" && code !== DisconnectReason.loggedOut) initBaileys() })

return sock }


⸙ Pairing Mode

import makeWASocket from "@whiskeysockets/baileys"

export async function pairing() { const sock = makeWASocket({ printQRInTerminal: false }) if (!sock.authState.creds.registered) { const number = process.env.OTAX_SENDER_NUMBER const code = await sock.requestPairingCode(number) console.log("Pairing Code:", code) } }


⸙ Event Handler

export function attachEvents(sock) { sock.ev.on("messages.upsert", async ({ messages }) => { for (const m of messages) { const text = m.message?.conversation || m.message?.extendedTextMessage?.text || "" if (/^/ping$/i.test(text)) await sock.sendMessage(m.key.remoteJid, { text: "⸙ OTAX — pong" }) } })

sock.ev.on("groups.update", console.log) sock.ev.on("presence.update", console.log) sock.ev.on("contacts.update", console.log) }


⸙ Media Utility

import { downloadMediaMessage } from "@whiskeysockets/baileys" import { createWriteStream } from "fs"

export async function saveImage(sock, m) { const stream = await downloadMediaMessage(m, "stream", {}, { reuploadRequest: sock.updateMediaMessage }) stream.pipe(createWriteStream("./file.jpeg")) }


⸙ Mode Rekomendasi

markOnlineOnConnect: false untuk mode silent syncFullHistory: true untuk pemulihan riwayat browser: Browsers.macOS("OTAX-System") agar sinkronisasi optimal linking: pairing code untuk deploy lewat panel atau Telegram


⸙ Keamanan

Gunakan environment variable untuk semua kredensial Hindari memasukkan nomor atau token langsung ke kode Amankan folder session Gunakan log minimal untuk menghindari bocor data Aktifkan anti-tamper saat produksi


⸙ Lisensi

Berbasis pada Baileys MIT license Distribusi mengikuti standar lisensi upstream Gunakan secara bertanggung jawab sesuai kebijakan WhatsApp


⸙ Dukungan

WhatsApp Owner: wa.me/6281945938917 Telegram Team: t.me/Otapengenkawin