r-functions
v1.0.0
Published
Functions for bot whatsapp
Downloads
8
Maintainers
Readme
Function for bot whatsapp
Example:
// declaration variable conn
const conn = client.conn
// send a text message (auto tagged)
conn.reply(m.chat, `Hello World`, m)
// send a react message
conn.sendReact(m.chat, `💀`, m.key)
// send a text message with progress bar
conn.sendProgress(m.chat, `Hello World`, m)
// send a ptv message from path, url, or buffer (video duration 10s)
conn.sendPtv(m.chat, `./src/video/tiktok.mp4`)
// send a text message with custom thumbnail
conn.sendMessageModify(m.chat, `Hello World`, m, {
title: '© pycos-bot',
largeThumb: true,
ads: false,
/* can buffer or url */
thumbnail: 'https://telegra.ph/file/a7ac2b46f82ef7ea083f9.jpg',
link: 'httpsr-devs.xyz'
})
// send a text message with custom thumbnail & fake quoted
conn.sendMessageModifyV2(m.chat, `Hello World`, '© pycos-bot', {
title: '© pycos-bot',
largeThumb: true,
ads: false,
/* can buffer or url */
thumbnail: 'https://telegra.ph/file/a7ac2b46f82ef7ea083f9.jpg',
link: 'https://r-devs.xyz'
})
// send a text message with fake quoted
conn.sendMessageVerify(m.chat, `Hello World`, '© pycos-bot')
// send a file from path, url, or buffer (auto extension)
conn.sendFile(m.chat, 'https://telegra.ph/file/a7ac2b46f82ef7ea083f9.jpg', 'image.jpg', 'Hello World', m)
// send a document from path, url, or buffer (auto extension)
conn.sendFile(m.chat, 'https://telegra.ph/file/a7ac2b46f82ef7ea083f9.jpg', 'image.jpg', 'Hello World', m, {
document: true
})
// send a voicenote from path, url, or buffer
conn.sendFile(m.chat, './src/mp3/chocos.mp3', '', '', m, {
ptt: true
})
// send a audio from path, url, or buffer with thumbnail in audio tag
conn.sendFile(m.chat, './src/mp3/chocos.mp3', '', '', m, {
APIC: < Buffer >
})
// send a sticker message from url or buffer
conn.sendSticker(m.chat, 'https://telegra.ph/file/a7ac2b46f82ef7ea083f9.jpg', m, {
packname: 'Powered by',
author: '© pycos-bot'
})
// send polling message
conn.sendPoll(m.chat, 'Do u like this library?', {
options: ['Yes bro', 'Not yet'],
multiselect: false
})
// send contact message
conn.sendContact(m.chat, [{
name: 'Rasya R.',
number: '6285791346128',
about: 'Developers'
}], m, {
org: 'Developers Internasional',
website: 'https://r-devs.xyz',
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: "Developer",
id: '.devs'
}),
}, {
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: "Website",
url: "https://r-devs.xyz",
merchant_url: "https://r-devs.xyz"
})
}, {
name: "cta_copy",
buttonParamsJson: JSON.stringify({
display_text: "Copy",
copy_code: "987654"
})
}, {
name: "cta_call",
buttonParamsJson: JSON.stringify({
display_text: "Call",
phone_number: "6285791346128"
})
}, {
name: "single_select",
buttonParamsJson: JSON.stringify({
title: "Click This!",
sections: [{
rows: [{
title: "Owner",
description: `Ny Developers`,
id: `.owner`
}, {
title: "Runtime",
description: `Runtime`,
id: `.run`
}]
}]
})
}]
// button & list
client.sendIAMessage(m.chat, buttons, m, {
header: '',
content: 'Hello World!',
footer: '',
media: global.db.setting.cover // video or image link
})
// carousel message
const cards = [{
header: {
imageMessage: global.cover,
hasMediaAttachment: true,
},
body: {
text: "Hello World"
},
nativeFlowMessage: {
buttons: [{
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: 'Contact Owner',
url: 'https://r-devs.xyz',
webview_presentation: null
})
}]
}
}, {
header: {
imageMessage: global.cover,
hasMediaAttachment: true,
},
body: {
text: "Hello World"
},
nativeFlowMessage: {
buttons: [{
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: 'Contact Owner',
url: 'https://r-devs.xyz',
webview_presentation: null
})
}]
}
}]
client.sendCarousel(m.chat, cards, m, {
content: 'Hello World!'
})
Thank You For
- Allah SWT.
- Nabi Muhammad SAW.
- My Parrents.
- My Friends.
- Wildan