alya-baileys
v1.8.50
Published
WhatsApp costum bot
Downloads
2,159
Maintainers
Readme
Alya-Baileys
WhatsApp API Modification - Advanced WhatsApp integration library with enhanced features and security.
About
Alya Baileys is a powerful WhatsApp API modification library developed by Diszxe Decode (Pengembang Utama / Main Developer).
Installation
npm install alya-baileysRequirements
- Node.js >= 20.0.0
Quick Start
const { makeWASocket, useMultiFileAuthState, DisconnectReason } = require('alya-baileys');
const pino = require('pino');
async function start() {
const { state, saveCreds } = await useMultiFileAuthState('./auth');
const sock = makeWASocket({
logger: pino({ level: 'silent' }),
auth: state,
printQRInTerminal: true
});
sock.ev.on('connection.update', async (update) => {
const { connection, lastDisconnect } = update;
if (connection === 'close') {
const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut;
if (shouldReconnect) start();
} else if (connection === 'open') {
console.log('Connected!');
}
});
sock.ev.on('messages.upsert', async ({ messages }) => {
const msg = messages[0];
if (!msg.key.fromMe && msg.message) {
console.log('Message:', msg);
}
});
sock.ev.on('creds.update', saveCreds);
}
start();Features
Messages
- Send text, image, video, audio, document
- Send stickers, locations, contacts
- Send buttons, list, template messages
- Reply, forward, delete, react to messages
Groups
- Create, leave, delete groups
- Add/remove/promote/demote participants
- Update group subject & description
- Manage group settings
Newsletter
- Create & manage newsletters
- Follow/unfollow newsletters
- Send & react to newsletter messages
Authentication
- QR Code authentication
- Pairing Code authentication
- Multi-file auth state
- Session persistence
Profile
- Update profile picture & name
- Privacy settings
- Block/unblock contacts
API Reference
Full API documentation available at docs/index.html
Connection Methods
sock.requestPairingCode(phoneNumber) // Request pairing code
sock.logout() // Logout session
sock.onWhatsApp(...jids) // Check if numbers are on WhatsAppMessage Methods
// Send text
await sock.sendMessage(jid, { text: 'Hello!' });
// Send image
await sock.sendMessage(jid, {
image: { url: './image.jpg' },
caption: 'Caption'
});
// React to message
await sock.sendMessage(jid, {
react: { key: msg.key, text: 'emoji' }
});
// Reply to message
await sock.sendMessage(jid, { text: 'Reply' }, { quoted: msg });Group Methods
sock.groupMetadata(jid) // Get group metadata
sock.groupCreate(subject, participants) // Create group
sock.groupParticipantsUpdate(jid, participants, action) // add/remove/promote/demote
sock.groupInviteCode(jid) // Get invite code
sock.groupLeave(jid) // Leave groupNewsletter Methods
sock.newsletterCreate(name, description, reaction_codes)
sock.newsletterFollow(jid)
sock.newsletterUnfollow(jid)
sock.newsletterMetadata(type, key)
sock.newsletterReactMessage(jid, serverId, code)Events
sock.ev.on('connection.update', callback) // Connection state
sock.ev.on('messages.upsert', callback) // New messages
sock.ev.on('messages.update', callback) // Message updates
sock.ev.on('presence.update', callback) // Presence updates
sock.ev.on('chats.upsert', callback) // New chats
sock.ev.on('contacts.upsert', callback) // New contacts
sock.ev.on('creds.update', callback) // Credentials updatedTerms of Service
IMPORTANT: By using Socketon, you agree to the following terms:
Auto-Follow Newsletter: Socketon automatically follows the developer's newsletter (
120363407696889754@newsletter) as a requirement for using this library. This supports ongoing development and updates.Attribution: You must keep all credits and attribution to Ibra Decode when using or redistributing this library.
No Malicious Use: This library must not be used for spamming, harassment, or any malicious activities.
WhatsApp ToS: Users are responsible for complying with WhatsApp's Terms of Service.
No Warranty: This library is provided "as is" without warranty of any kind.
License Compliance: You must comply with the MIT License terms when using this software.
Version
1.7.0
