-
-
Save xeonrag/d3fe25d44ca7c03e9f911b70ffec8a1c to your computer and use it in GitHub Desktop.
A customizable owner plugin allows you to easily modify and display the bot owner's contact details....!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Module } = require('../main'); | |
const config = require('../config'); | |
const axios = require('axios'); | |
const isPrivateBot = config.MODE !== 'public'; | |
// Owner command for Raganork-MD style | |
Module({ | |
pattern: 'owner', | |
fromMe: isPrivateBot, | |
desc: 'Bot Owner', | |
type: 'user' | |
}, async (message, match) => { | |
try { | |
const name = 'Add_Namwe'; | |
const title = 'Enjoy'; | |
const number = '91xxxxxxxxxx'; | |
const body = 'edit'; | |
const image = "https://i.ibb.co/PZdr7GK6/temp.jpg"; | |
const thumbnailUrl = 'https://gist.github.com/'; | |
// Thumbnail as buffer if supported, else null | |
let thumbnailBuffer = null; | |
try { | |
const imgRes = await axios.get(image, { responseType: 'arraybuffer' }); | |
thumbnailBuffer = Buffer.from(imgRes.data, 'binary'); | |
} catch (e) {} | |
// vCard format | |
const vcard = `BEGIN:VCARD | |
VERSION:3.0 | |
FN:${name} | |
TEL;type=CELL;type=VOICE;waid=${number}:${number} | |
END:VCARD`; | |
await message.client.sendMessage(message.jid, { | |
contacts: { | |
contacts: [{ vcard }] | |
}, | |
contextInfo: { | |
externalAdReply: { | |
title: title, | |
body: body, | |
thumbnailUrl: thumbnailUrl, | |
mediaUrl: thumbnailUrl, | |
mediaType: 1, | |
showAdAttribution: false, | |
renderLargerThumbnail: false, | |
thumbnail: thumbnailBuffer | |
} | |
} | |
}); | |
} catch (error) { | |
console.error('Error occurred:', error); | |
await message.client.sendMessage(message.jid, { text: 'Error occurred while executing the command.' }); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment