Simplicity WhatsApp Bot (Baileys)
This is a WhatsApp bot module based on Baileys which can be used in a very easy way.
Example
For example of use you can open the example folder or here for example base
![](https://telegra.ph/file/109138edd11434ddcc30d.png)
Handling Events
There are several events that can be used are as follows :
client.on('connect', () => console.log)
client.on('error', error => console.log(error))
client.on('ready', () => console.log)
client.on('message', ctx => console.log(ctx))
client.on('message.delete', ctx => console.log(ctx))
client.on('group.add', ctx => console.log(ctx))
client.on('group.remove', ctx => console.log(ctx))
client.on('group.promote', ctx => console.log(ctx))
client.on('group.demote', ctx => console.log(ctx))
client.on('caller', ctx => console.log(ctx))
client.on('presence.update', ctx => console.log(ctx))
Event Message (message)
{
m: {
key: {
remoteJid: '6285887776722@s.whatsapp.net',
fromMe: false,
id: 'A4A5E1FB9C33178CD11673178C46CA1E',
participant: undefined
},
messageTimestamp: 1689557472,
pushName: 'Wildan Izzudin',
broadcast: false,
message: Message {
extendedTextMessage: [ExtendedTextMessage],
messageContextInfo: [MessageContextInfo]
},
id: 'A4A5E1FB9C33178CD11673178C46CA1E',
isBot: false,
chat: '6285887776722@s.whatsapp.net',
fromMe: false,
isGroup: false,
sender: '6285887776722@s.whatsapp.net',
mtype: 'extendedTextMessage',
msg: ExtendedTextMessage {
text: '.menu',
previewType: 0,
contextInfo: [ContextInfo],
inviteLinkGroupTypeV2: 0
},
quoted: null,
mentionedJid: [],
reply: [Function(anonymous)],
text: '.menu'
},
body: '.menu',
prefix: '.',
plugins: [],
commands: [],
args: [],
command: 'menu',
text: '',
prefixes: ['.', '#', '!', '/']
}
Messaging Function
const sock = client.sock
sock.reply(m.chat, `Test!`, m)
sock.sendReact(m.chat, `💀`, m.key)
sock.sendProgress(m.chat, `Test!`, m)
sock.sendPtv(m.chat, `./media/video/yemete.mp4`)
sock.sendMessageModify(m.chat, `Test!`, m, {
title: '© neoxr-bot',
largeThumb: true,
ads: false,
thumbnail: 'https://iili.io/HP3ODj2.jpg',
link: 'https://chat.whatsapp.com/HYknAquOTrECm9KPJJQO1V'
})
sock.sendFile(m.chat, 'https://iili.io/HP3ODj2.jpg', 'image.jpg', 'Test!', m)
sock.sendFile(m.chat, 'https://iili.io/HP3ODj2.jpg', 'image.jpg', 'Test!', m, {
document: true
})
sock.sendFile(m.chat, './media/audio/ah.mp3', '', '', m, {
ptt: true
})
sock.sendFile(m.chat, './media/audio/ah.mp3', '', '', m, {
APIC: < Buffer >
})
sock.sendSticker(m.chat, 'https://iili.io/HP3ODj2.jpg', m, {
packname: 'Sticker by',
author: '© neoxr.js'
})
sock.copyNForward(m.chat, m)