@im-dims/prime
v0.2.2
Published
All class functions for mari-wabot
Downloads
169
Readme
Simplicity WhatsApp Bot (Baileys)
This is a WhatsApp bot module based on Baileys which can be used in a very easy way.
Get Started
const loli = new(require('@im-dims/prime'))
console.log(loli)
Event Message (message)
WebMessageInfo {
messageStubParameters: [],
labels: [],
userReceipt: [],
reactions: [],
pollUpdates: [],
eventResponses: [],
key: MessageKey {
remoteJid: '[email protected]',
fromMe: false,
id: '32797FA1DDA4B27626EC95E76B0E7CC5',
participant: '[email protected]'
},
message: Message { conversation: '=> m' },
messageTimestamp: Long { low: 1730019648, high: 0, unsigned: true },
broadcast: false,
pushName: 'Dimas',
id: '32797FA1DDA4B27626EC95E76B0E7CC5',
isBaileys: false,
chat: '[email protected]',
isGroup: true,
sender: '[email protected]',
fromMe: false,
mtype: 'conversation',
msg: '=> m',
text: '=> m',
mentionedJid: [],
quoted: null,
name: 'Dimas',
reply: [Function (anonymous)],
react: [Function (anonymous)],
copy: [Function (anonymous)],
forward: [Function (anonymous)],
copyNForward: [Function (anonymous)],
cMod: [Function (anonymous)],
delete: [Function (anonymous)],
exp: 24,
limit: false,
plugin: 'owner-eval.js',
isCommand: true
}
Messaging Function
// send a text message (auto tagged)
conn.reply(m.chat, `Test!`, m)
// send a react message
conn.sendReact(m.chat, `💀`, m.key)
// send a text message with progress bar
conn.sendProgress(m.chat, `Test!`, m)
// send a text message with custom thumbnail
conn.sendMessageModify(m.chat, 'Hi!', m, {
title: '© mari-bot',
largeThumb: true,
/* can buffer or url */
thumbnail: 'https://i.ibb.co/DfksZNg/image.jpg',
link: 'https://chat.whatsapp.com/JDihQ498jwH9UKu8kFaT9N'
})
// send a file from path, url, or buffer (auto extension)
conn.sendFile(m.chat, 'https://i.ibb.co/DfksZNg/image.jpg', 'image.jpg', 'Test!', m)
// send a document from path, url, or buffer (auto extension)
conn.sendFile(m.chat, 'https://i.ibb.co/DfksZNg/image.jpg', 'image.jpg', 'Test!', m, {
document: true
})
// send a voicenote from path, url, or buffer
conn.sendFile(m.chat, './media/audio/ah.mp3', '', '', m, {
ptt: true
})
// send a audio from path, url, or buffer with thumbnail in audio tag
conn.sendFile(m.chat, './media/audio/ah.mp3', '', '', m, {
APIC: < Buffer >
})
// send a sticker message from url or buffer
conn.sendSticker(m.chat, 'https://i.ibb.co/DfksZNg/image.jpg', m, {
packname: 'Sticker by',
author: '© mari-bot'
})
// send polling message
conn.sendPoll(m.chat, 'Do you like this library ?', {
options: ['Yes', 'No'],
multiselect: false
})
// send contact message
conn.sendContact(m.chat, [{
name: 'Dimas T',
number: '6281398274790,
about: 'Owner & Creator'
}], m, {
org: 'Dims Network',
website: 'https://api.ssateam.my.id',
email: '[email protected]'
})
// forward message
conn.copyNForward(m.chat, m)
// send button message (your own risk)
var buttons = [{
name: "quick_reply",
buttonParamsJson: JSON.stringify({
display_text: "OWNER",
id: '.owner'
}),
}, {
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: "Rest API",
url: "https://api.neoxr.my.id",
merchant_url: "https://api.neoxr.my.id"
})
}, {
name: "cta_copy",
buttonParamsJson: JSON.stringify({
display_text: "Copy",
copy_code: "123456"
})
}, {
name: "cta_call",
buttonParamsJson: JSON.stringify({
display_text: "Call",
phone_number: "6285887776722"
})
}, {
name: "single_select",
buttonParamsJson: JSON.stringify({
title: "Tap!",
sections: [{
rows: [{
title: "Owner",
description: `X`,
id: `.owner`
}, {
title: "Runtime",
description: `Y`,
id: `.run`
}]
}]
})
}]
// button & list
client.sendIAMessage(m.chat, buttons, m, {
header: '',
content: 'Hi!',
footer: '',
media: global.db.setting.cover // video or image link
})