Your complete documentation for using @trashcore/baileys
Choose the method that best fits your development needs:
Install the latest stable version from npm. Best for production.
"dependencies": {
"@trashcore/baileys": "latest"
}
Install the exact stable version from npm.
"dependencies": {
"@trashcore/baileys": "^4.2.7"
}
Then run:
npm install
Install directly from the official GitHub repo for the latest features (may be unstable).
"dependencies": {
"@trashcore/baileys": "github:Tennor-modz/MD-Baileys"
}
Or install via CLI:
npm install github:Tennor-modz/MD-Baileys
Use your own or a modified fork for custom features or fixes.
"dependencies": {
"@trashcore/baileys": "github:your-username/baileys"
}
Replace your-username with your GitHub handle.
npm install
Keep your existing imports by aliasing the package.
"dependencies": {
"@whiskeysockets/baileys": "npm:@trashcore/baileys@latest"
}
Get your bot running in minutes with this simple setup:
const {
default: TrashcoreConnect
} = require('@trashcore/baileys');
async function startBot() {
const trashcore = await TrashcoreConnect({
printQRInTerminal: true
});
trashcore.ev.on('messages.upsert', async (m) => {
const msg = m.messages[0];
if (!msg.message) return;
const text = msg.message.conversation;
if (text === 'ping') {
await trashcore.sendMessage(msg.key.remoteJid, { text: 'pong!' });
}
});
// Custom pairing example
const phoneNumber = '+1234567890';
const cleanNumber = phoneNumber.replace(/[^0-9]/g, '');
console.clear();
const custom = "TRASHBOT";
const pairCode = await trashcore.requestPairingCode(cleanNumber, custom);
}
startBot();
Configure the browser environment for optimal performance:
browser: ["Ubuntu", "Opera", "100.0.4815.0"]
Organize your project with this recommended structure:
my-bot/ ├── index.js ├── package.json └── node_modules/
pkg install git
npm install
Update to 4.2.7. Private-chat messages no longer carry the AI bot node by default.
npm install @trashcore/baileys@latest
Update to 4.2.7. Hosted companion devices are now skipped when sending.
npm install @trashcore/baileys@latest
Update to 4.2.7, then delete the old session files once (use your own auth folder name) and restart. Re-link the device if needed.
rm -rf session/session-*.json
Secure login with QR code scanning for WhatsApp Web sessions
Alternative login method using phone number pairing
Optimized for speed with minimal resource usage