Installation & Quick Start
Installing Baileys (UDMODZ Edition) is straightforward. The package is published on npm as amiudmodz and is fully backwards-compatible with baileys code.
Installation
Run the following command in your project directory:
- npm
- Yarn
- pnpm
npm install amiudmodz
yarn add amiudmodz
pnpm add amiudmodz
Quick Start Example
This code illustrates how to establish a socket connection and immediately use UDMODZ-exclusive features such as the Meta AI badge.
import makeWASocket, { useMultiFileAuthState } from 'amiudmodz'
async function start() {
// 1. Initialize authentication state
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
// 2. Create the connection socket
const sock = makeWASocket({
auth: state,
printQRInTerminal: true, // Display QR code in console if not linked
})
// 3. Save credentials when updated
sock.ev.on('creds.update', saveCreds)
// 4. Handle incoming messages & send responses
sock.ev.on('messages.upsert', async (m) => {
const msg = m.messages[0]
if (!msg.message || msg.key.fromMe) return
const jid = msg.key.remoteJid!
const text = msg.message.conversation || msg.message.extendedTextMessage?.text
if (text === 'ping') {
// Send an AI-themed response
await sock.sendMessage(jid, {
text: 'Pong! Generated in real-time.',
ai: true, // Exclusive UDMODZ Feature: Meta AI ✦ icon
})
}
})
}
start().catch(console.error)
Upgrading from Vanilla Baileys
To upgrade an existing project, replace the package dependency and adjust your imports:
- Uninstall the vanilla package and install
amiudmodz:npm uninstall @whiskeysockets/baileys
npm install amiudmodz - Replace all import statements:
// Old
import makeWASocket from '@whiskeysockets/baileys'
// New
import makeWASocket from 'amiudmodz' - Run your code! No database schema or signal store changes are needed.